AWS CDK
Basic actions
Install or update the CDK cli:
sudo npm install -g aws-cdk@latest
Initialise the code:
cdk init app --language typescript
Bootstrap the AWS account
cdk bootstrap aws://$AWS_ACCOUNT_ID/$AWS_REGION
cdk ls
See what the Cloudformation template will look like:
cdk synth $STACK_NAME
Check the diff between what is currently deployed and what is currently declared in the code:
cdk diff $STACK_NAME
Deploy the stack
cdk deploy $STACK_NAME
Destroy the stack
cdk destroy $STACK_NAME
Environment variables
CDK_DEFAULT_ACCOUNT
Specifies an AWS account id to deploy to.
CDK_DEFAULT_REGION
Specifies an AWS region to deploy to.