This skill provides setup guidance for working with AWS CDK (Cloud Development Kit) projects using Python.
Before starting, ensure the following tools are installed:
npm install -g aws-cdk
cdk --version
# Install AWS CLI (if not installed)
brew install awscli
# Configure credentials
aws configure
Enter your AWS Access Key, Secret Access Key, default region, and output format when prompted.
mkdir my-cdk-project
cd my-cdk-project
cdk init app --language python
Your project will include:
app.py — Main application entry pointmy_cdk_project/ — CDK stack definitionsrequirements.txt — Python dependenciescdk.json — Configuration file# macOS/Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
Primary dependencies:
aws-cdk-lib — Core CDK constructsconstructs — Base construct librarycdk synth
Generates cdk.out/ containing CloudFormation templates.
cdk deploy
Reviews and confirms deployment to the configured AWS account.
cdk bootstrap
Prepares environment resources like S3 buckets for asset storage.
cdk diff before deployment to preview changes.requirements.txt pinned for consistent builds.If issues occur, check:
cdk doctor to diagnose environment issues.