This project recasts into an AWS Cloud Development Kit (CDK) application the prescriptive guidance for using CloudFormation's inbuilt blue-green deployment strategy for Amazon Elastic Container Service (ECS).
As a simple example, this application uses one ECS Fargate service with the public nginxdemos/hello
Docker image. To demonstrate the blue-green deployment strategy, specify as a CDK context variable the particular Docker image tag for nginxdemos/hello
to deploy. If not specified at the command line, latest
will be used for the default image tag.
- Install CDK globally:
npm install -g aws-cdk
- Install local Node.js dependencies:
npm install
- Build the project:
npm run build
- Bootstrap the CDK Toolkit into your AWS account:
cdk bootstrap
- Deploy the stack:
cdk deploy -c image-tag=[latest|plain-text]
npm run build
compile project todist
npm run clean
delete everything incdk.out
anddist
npm 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