The cdk.json file tells the CDK Toolkit how to execute your app.
npm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation template
To be able to synthesize / deploy the stacks, one must first initialize cdk.context.json using target AWS account, if your target account differs from the accounts that are in the version controlled cdk.context.json file.
aws-vault exec AWS_PROFILE_NAME -- cdk synth -c vpcId=AWS_VPC_ID
- replace
AWS_PROFILE_NAMEwith target account profile name - replace
AWS_VPC_IDwith target vpc id
This will populate your local cdk.context.json file with metadata about the target AWS environment. After this, you can synthesize, diff, deploy, run tests, etc. without providing context variables in the commands.