This repository shows an example of how to deploy a simple docker image to a Fargate cluster using AWS CDK.
MIT License
This repository shows an example of how to deploy a simple docker image to a Fargate cluster using AWS CDK.
Read more of CDK at https://docs.aws.amazon.com/CDK/latest/userguide/what-is.html
Features:
aws-cdk-lib
Check that your AWS account is configured. Assume the role in the shell:
# Install from https://github.com/remind101/assume-role
eval $(assume-role your-aws-role)
First you need to have the needed build tools and the AWS CDK installed. After everything is installed you can bootstrap the project on wanted account.
brew install node awscli
# Install or update CDK globally
npm i -g aws-cdk
# Check that the infra can be synthetized
cdk synth
# Initialize the environment
cdk bootstrap aws://account-id/region
Take a note of the certificated ARN's that are needed for the deployment.
Check that the stack builds.
npm run build
Bootstrap the account.
cdk bootstrap aws://<account>/eu-west-1 -c certificateIdentifier=e3da8de9-ec36-4c75-addd-cc62701eac3a -c domainName=olmi.be -c subdomainName=site-dev -c environment=dev
Deploy the dev version
cdk deploy -c certificateIdentifier=e3da8de9-ec36-4c75-addd-cc62701eac3a -c domainName=olmi.be -c subdomainName=site-dev -c environment=dev
Change the parameters to deploy a prod version:
cdk deploy -c certificateIdentifier=2ff0d9f4-98be-477a-a29f-86d871d5e31f -c domainName=olmi.be -c subdomainName=site-prod -c environment=prod
npm run build
compile typescript to jsnpm run watch
watch for changes and compilecdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template