AWS CDK (Bare Essentials for DVA-C02)

What is AWS CDK?

AWS Cloud Development Kit (CDK) lets you define AWS infrastructure using programming languages such as TypeScript, Python, Java, C#, and Go instead of writing CloudFormation YAML/JSON manually.


CDK Workflow (Remember This)

Write CDK Code
      ↓
cdk synth
      ↓
CloudFormation Template (cdk.out/)
      ↓
cdk diff (optional)
      ↓
Shows changes
      ↓
cdk deploy
      ↓
Deploys to AWS

cdk synth

Purpose: Generate (synthesize) the CloudFormation template.

Exam Tip:

"Generate CloudFormation template" = cdk synth


cdk deploy

Purpose: Deploy the infrastructure.

Exam Tip:

Deploy infrastructure = cdk deploy


cdk diff

Purpose: Compare changes.

Exam Tip:

View changes before deployment = cdk diff


cdk build

There is no standard CDK command called cdk build.

Exam Tip:

Compiling code ≠ Synthesizing CloudFormation


Commands to Remember

Command Purpose
cdk synth Generate CloudFormation template (cdk.out)
cdk diff Show differences between deployed stack and local code
cdk deploy Deploy CloudFormation stack to AWS
cdk destroy Delete deployed stack

DVA-C02 Exam Memory Trick


Likely Exam Question

Which command generates a CloudFormation template that can be reviewed before deployment?

Answer: cdk synth

Because it converts the CDK application into a CloudFormation template and stores it in the cdk.out/ directory before anything is deployed.