AWS CDK Python Setup

AWS CDK Python Setup

Walks through setting up an AWS CDK project in Python: prerequisites, CLI install, credentials, virtualenv, dependencies, synth and deploy.

Skill files1 file
SKILL.md112 lines
1
---
2
name: aws-cdk-python-setup
3
description: 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.
4
---
5
# AWS CDK Python Setup Instructions
6
7
This skill provides setup guidance for working with **AWS CDK (Cloud Development Kit)** projects using **Python**.
8
9
---
10
11
## Prerequisites
12
13
Before starting, ensure the following tools are installed:
14
15
- **Node.js** ≥ 14.15.0 — Required for the AWS CDK CLI
16
- **Python** ≥ 3.7 — Used for writing CDK code
17
- **AWS CLI** — Manages credentials and resources
18
- **Git** — Version control and project management
19
20
---
21
22
## Installation Steps
23
24
### 1. Install AWS CDK CLI
25
```bash
26
npm install -g aws-cdk
27
cdk --version
28
```
29
30
### 2. Configure AWS Credentials
31
```bash
32
# Install AWS CLI (if not installed)
33
brew install awscli
34
35
# Configure credentials
36
aws configure
37
```
38
Enter your AWS Access Key, Secret Access Key, default region, and output format when prompted.
39
40
### 3. Create a New CDK Project
41
```bash
42
mkdir my-cdk-project
43
cd my-cdk-project
44
cdk init app --language python
45
```
46
47
Your project will include:
48
- `app.py` — Main application entry point
49
- `my_cdk_project/` — CDK stack definitions
50
- `requirements.txt` — Python dependencies
51
- `cdk.json` — Configuration file
52
53
### 4. Set Up Python Virtual Environment
54
```bash
55
# macOS/Linux
56
source .venv/bin/activate
57
58
# Windows
59
.venv\Scripts\activate
60
```
61
62
### 5. Install Python Dependencies
63
```bash
64
pip install -r requirements.txt
65
```
66
Primary dependencies:
67
- `aws-cdk-lib` — Core CDK constructs
68
- `constructs` — Base construct library
69
70
---
71
72
## Development Workflow
73
74
### Synthesize CloudFormation Templates
75
```bash
76
cdk synth
77
```
78
Generates `cdk.out/` containing CloudFormation templates.
79
80
### Deploy Stacks to AWS
81
```bash
82
cdk deploy
83
```
84
Reviews and confirms deployment to the configured AWS account.
85
86
### Bootstrap (First Deployment Only)
87
```bash
88
cdk bootstrap
89
```
90
Prepares environment resources like S3 buckets for asset storage.
91
92
---
93
94
## Best Practices
95
96
- Always activate the virtual environment before working.
97
- Run `cdk diff` before deployment to preview changes.
98
- Use development accounts for testing.
99
- Follow Pythonic naming and directory conventions.
100
- Keep `requirements.txt` pinned for consistent builds.
101
102
---
103
104
## Troubleshooting Tips
105
106
If issues occur, check:
107
108
- AWS credentials are correctly configured.
109
- Default region is set properly.
110
- Node.js and Python versions meet minimum requirements.
111
- Run `cdk doctor` to diagnose environment issues.
112

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…