All skills
github avatar

/aws-cdk-python-setup

@a31b09b official
by githubgithub/awesome-copilot40k stars
5,040

Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment prerequisites, create new CDK projects, manage dependencies, and deploy to AWS.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/aws-cdk-python-setup

This session only. Nothing lands on disk.

SKILL.md

≈63 tokens always: the name and description. ≈585 when used: this file.

AWS CDK Python Setup Instructions

This skill provides setup guidance for working with AWS CDK (Cloud Development Kit) projects using Python.


Prerequisites

Before starting, ensure the following tools are installed:

  • Node.js ≥ 14.15.0 — Required for the AWS CDK CLI
  • Python ≥ 3.7 — Used for writing CDK code
  • AWS CLI — Manages credentials and resources
  • Git — Version control and project management

Installation Steps

1. Install AWS CDK CLI

npm install -g aws-cdk
cdk --version

2. Configure AWS Credentials

# 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.

3. Create a New CDK Project

mkdir my-cdk-project
cd my-cdk-project
cdk init app --language python

Your project will include:

  • app.py — Main application entry point
  • my_cdk_project/ — CDK stack definitions
  • requirements.txt — Python dependencies
  • cdk.json — Configuration file

4. Set Up Python Virtual Environment

# macOS/Linux
source .venv/bin/activate

# Windows
.venv\Scripts\activate

5. Install Python Dependencies

pip install -r requirements.txt

Primary dependencies:

  • aws-cdk-lib — Core CDK constructs
  • constructs — Base construct library

Development Workflow

Synthesize CloudFormation Templates

cdk synth

Generates cdk.out/ containing CloudFormation templates.

Deploy Stacks to AWS

cdk deploy

Reviews and confirms deployment to the configured AWS account.

Bootstrap (First Deployment Only)

cdk bootstrap

Prepares environment resources like S3 buckets for asset storage.


Best Practices

  • Always activate the virtual environment before working.
  • Run cdk diff before deployment to preview changes.
  • Use development accounts for testing.
  • Follow Pythonic naming and directory conventions.
  • Keep requirements.txt pinned for consistent builds.

Troubleshooting Tips

If issues occur, check:

  • AWS credentials are correctly configured.
  • Default region is set properly.
  • Node.js and Python versions meet minimum requirements.
  • Run cdk doctor to diagnose environment issues.

Source: SKILL.md on GitHub

No alerts16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides standard, safe instructions for setting up an AWS CDK environment using official tools and well-known package managers.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at a31b09b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 19 hours ago.

Activeupdated 7 months ago
  • Python
  • aws-cdk
  • infrastructure-as-code
  • cloudformation
  • aws
  • setup
  • deployment

README badge

README badge for github/awesome-copilot/aws-cdk-python-setup

Provides step-by-step setup and initialization for AWS CDK Python projects, covering Node.js and Python prerequisites, AWS credential configuration, virtual environment setup, and basic deployment workflows. Targets developers starting new CDK projects in Python and includes commands for synthesizing CloudFormation templates and bootstrapping AWS environments.

Generated from the current SKILL.md.

What are the minimum Node.js and Python versions required?
Node.js ≥ 14.15.0 and Python ≥ 3.7. Node.js is required for the AWS CDK CLI even though you write infrastructure code in Python.
Do I need to bootstrap my AWS environment before deploying?
Yes, run `cdk bootstrap` once per AWS account/region before your first deployment. It creates S3 buckets and other resources needed to store CDK assets.
What's the difference between `cdk synth` and `cdk deploy`?
`cdk synth` generates CloudFormation templates locally without touching AWS. `cdk deploy` reviews the changes and deploys the stacks to your configured AWS account.
How do I preview what will change before deploying?
Run `cdk diff` to see a diff of the changes that will be applied to your AWS resources.
What should I do if deployment fails?
Verify AWS credentials are configured, the default region is set, Node.js and Python versions meet requirements, and run `cdk doctor` to diagnose environment issues.

Generated from the current SKILL.md. These answers refresh after source changes.