cdk-load-balance-autoscaling-groups
cdk-load-balance-autoscaling-groups copied to clipboard
CDK Example Code to deploy Load Balanced Scaling Groups
Create a Load Balancer and two AutoScaling Group
This code creates an Application Load Balancer and Two Auto Scaling groups. It serves as basis to configure blue / green deployments.
Getting started
Initial tasks (to execute only once)
- Install CDK : https://docs.aws.amazon.com/en_pv/cdk/latest/guide/getting_started.html
npm install -g aws-cdk
- Bootstrap the CDK environment
cdk boostrap
For each redeployment
- Build the code
npm run build
- Deploy the code
cdk deploy
Cleanup
To cleanup the environment when you are done testing :
cdk destroy
Application versions
The sample app is a sample static HTML page, taken from Boostrap's sample. Two versions of the same app are deployed. The blue version is deployed to the blue scaling group and the green version is deployed to the green group.
Useful commands
-
npm run build
compile typescript to js -
npm run watch
watch for changes and compile -
npm run test
perform the jest unit tests -
cdk deploy
deploy this stack to your default AWS account/region -
cdk diff
compare deployed stack with current state -
cdk synth
emits the synthesized CloudFormation template