Skip to content

Commit 598f021

Browse files
committed
Added AWS CDK Python setup instructions
1 parent 8d91380 commit 598f021

2 files changed

Lines changed: 138 additions & 0 deletions

File tree

docs/README.instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-instructions) for guidelines on
3131
| [ASP.NET REST API Development](../instructions/aspnet-rest-apis.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Faspnet-rest-apis.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Faspnet-rest-apis.instructions.md) | Guidelines for building REST APIs with ASP.NET |
3232
| [Astro Development Instructions](../instructions/astro.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fastro.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fastro.instructions.md) | Astro development standards and best practices for content-driven websites |
3333
| [AWS AppSync Event API Instructions](../instructions/aws-appsync.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Faws-appsync.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Faws-appsync.instructions.md) | Production-grade guidance for AWS AppSync Event API handlers using APPSYNC_JS runtime restrictions, utilities, modules, and datasource patterns |
34+
| [AWS CDK Python Setup Instructions](../instructions/aws-cdk-python-setup.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Faws-cdk-python-setup.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Faws-cdk-python-setup.instructions.md) | Setup instructions for AWS CDK Python projects |
3435
| [Azure DevOps Pipeline YAML Best Practices](../instructions/azure-devops-pipelines.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-devops-pipelines.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-devops-pipelines.instructions.md) | Best practices for Azure DevOps Pipeline YAML files |
3536
| [Azure Functions Typescript](../instructions/azure-functions-typescript.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-functions-typescript.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-functions-typescript.instructions.md) | TypeScript patterns for Azure Functions |
3637
| [Azure Logic Apps and Power Automate Instructions](../instructions/azure-logic-apps-power-automate.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-logic-apps-power-automate.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-logic-apps-power-automate.instructions.md) | Guidelines for developing Azure Logic Apps and Power Automate workflows with best practices for Workflow Definition Language (WDL), integration patterns, and enterprise automation |
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
description: 'Setup instructions for AWS CDK Python projects'
3+
applyTo: '**/*.py'
4+
---
5+
6+
# AWS CDK Python Setup Instructions
7+
8+
This instructions file provides guidance for setting up and working with AWS CDK (Cloud Development Kit) projects using Python. These instructions apply to Python files in CDK projects.
9+
10+
## Prerequisites
11+
12+
Before starting with AWS CDK Python development, ensure you have the following installed:
13+
14+
- **Node.js** (version 14.15.0 or later) - Required for the AWS CDK CLI
15+
- **Python** (version 3.7 or later)
16+
- **AWS CLI** - For configuring AWS credentials and managing AWS resources
17+
- **Git** - For version control
18+
19+
## Installation Steps
20+
21+
### 1. Install AWS CDK CLI
22+
23+
The AWS CDK CLI is a Node.js package that provides the `cdk` command.
24+
25+
```bash
26+
npm install -g aws-cdk
27+
```
28+
29+
Verify the installation:
30+
31+
```bash
32+
cdk --version
33+
```
34+
35+
### 2. Configure AWS Credentials
36+
37+
Install and configure the AWS CLI:
38+
39+
```bash
40+
# Install AWS CLI (if not already installed)
41+
# On macOS, you can use Homebrew:
42+
brew install awscli
43+
44+
# Configure AWS credentials
45+
aws configure
46+
```
47+
48+
Enter your AWS Access Key ID, Secret Access Key, default region, and output format when prompted.
49+
50+
### 3. Create a New CDK Project
51+
52+
Create a new directory for your CDK project and initialize it:
53+
54+
```bash
55+
mkdir my-cdk-project
56+
cd my-cdk-project
57+
cdk init app --language python
58+
```
59+
60+
This creates a basic CDK app structure with:
61+
- `app.py` - Main application entry point
62+
- `my_cdk_project/` - Python package containing your CDK stacks
63+
- `requirements.txt` - Python dependencies
64+
- `cdk.json` - CDK configuration
65+
66+
### 4. Set Up Python Virtual Environment
67+
68+
CDK Python projects include a virtual environment. Activate it:
69+
70+
```bash
71+
# On macOS/Linux
72+
source .venv/bin/activate
73+
74+
# On Windows
75+
.venv\Scripts\activate
76+
```
77+
78+
### 5. Install Python Dependencies
79+
80+
Install the required Python packages:
81+
82+
```bash
83+
pip install -r requirements.txt
84+
```
85+
86+
The main dependencies include:
87+
- `aws-cdk-lib` - Core CDK constructs
88+
- `constructs` - Base construct library
89+
90+
## Development Workflow
91+
92+
### Synthesize CloudFormation Templates
93+
94+
Generate CloudFormation templates from your CDK code:
95+
96+
```bash
97+
cdk synth
98+
```
99+
100+
This creates `cdk.out/` directory with synthesized templates.
101+
102+
### Deploy to AWS
103+
104+
Deploy your CDK stacks to AWS:
105+
106+
```bash
107+
cdk deploy
108+
```
109+
110+
Review the changes and confirm deployment when prompted.
111+
112+
### Bootstrap (First Time Only)
113+
114+
If deploying to a new AWS account/region, bootstrap the environment:
115+
116+
```bash
117+
cdk bootstrap
118+
```
119+
120+
This sets up necessary resources like S3 buckets for storing assets.
121+
122+
## Best Practices
123+
124+
- Always activate the virtual environment before working
125+
- Use `cdk diff` to preview changes before deployment
126+
- Test deployments in development accounts first
127+
- Use AWS CDK constructs for infrastructure as code
128+
- Follow Python naming conventions and structure
129+
130+
## Troubleshooting
131+
132+
- Ensure AWS credentials are properly configured
133+
- Check that the correct AWS region is set
134+
- Verify Node.js and Python versions meet requirements
135+
- Use `cdk doctor` to diagnose common issues
136+
137+
For detailed documentation, refer to the official AWS CDK documentation and the attached `awscdk.pdf` file.

0 commit comments

Comments
 (0)