# npm install -g aws-cdk
npm install -g typescript
cdk init app --language typescript
The cdk.json
file tells the CDK Toolkit how to execute your app.
$ cdk list
PrimaryRegionStack
SecondRegionStack
PrimaryRegionRouteStack
SecondRegionRouteStack
ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text)
AWS_PRIMARY_REGION=ap-northeast-1
AWS_SECONDARY_REGION=ap-northeast-3
cdk bootstrap aws://$ACCOUNT_ID/$AWS_PRIMARY_REGION
cdk bootstrap aws://$ACCOUNT_ID/$AWS_SECONDARY_REGION
cdk deploy "*" --tags tester=gekal
$ cdk destroy "*"
Are you sure you want to delete: SecondRegionRouteStack, PrimaryRegionRouteStack, SecondRegionStack, PrimaryRegionStack (y/n)? y
SecondRegionRouteStack: destroying...
✅ SecondRegionRouteStack: destroyed
PrimaryRegionRouteStack: destroying...
✅ PrimaryRegionRouteStack: destroyed
SecondRegionStack: destroying...
✅ SecondRegionStack: destroyed
PrimaryRegionStack: destroying...
✅ PrimaryRegionStack: destroyed
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template