Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kiro Power: AWS CDK Python

Build well-architected AWS infrastructure with Python CDK directly from Kiro using natural language. This Power wraps the official awslabs.aws-iac-mcp-server and adds Python CDK-specific steering, security validation workflows, and guided hooks.

What You Get

  • 9 tools — CDK docs search, Python code samples, best practices, cfn-lint validation, cfn-guard compliance, deployment troubleshooting, CloudFormation docs, and full page reader
  • Python CDK steering — conventions, project structure, construct patterns, anti-patterns
  • Validation workflow — synth → cfn-lint → cfn-guard → deploy pipeline
  • Security checklist — IAM, encryption, network, data protection, CDK-NAG integration
  • Hooks — auto-validate after synth, best-practice check on save, pre-deploy gate
  • Project template — production-ready scaffold with cdk-nag, pytest, multi-env config
  • Zero AWS credentials needed for 8 of 9 tools (only troubleshooting needs credentials)

Prerequisites

Requirement Purpose Install
uv Runs the MCP server via uvx https://docs.astral.sh/uv/getting-started/installation/
Python 3.10+ CDK application code uv python install 3.10
AWS CDK CLI Synthesize and deploy stacks npm install -g aws-cdk
AWS Credentials Only for troubleshooting failed stacks aws configure

Installation

  1. Clone this repo:

    git clone https://github.com/intraedge-services/kiro-powers-aws-iaac.git
  2. Open Kiro IDE → Powers panel → "Add power from Local Path" → select the cloned directory

  3. The MCP server connects automatically via uvx

Verify

In Kiro chat, type: "Get CDK best practices"

You should see the CDK best practices guide returned. No AWS credentials needed for this test.

Usage

Talk to Kiro in natural language:

Search for Python CDK patterns for API Gateway with Lambda
Show me how to create a secure S3 bucket in CDK Python
Validate this CloudFormation template for errors
Check this template for security compliance
Troubleshoot my failed stack MyAppStack in us-east-1
Scaffold a new CDK project for a serverless API

Python-First Samples

When searching for code samples, results are filtered for Python:

Find CDK code samples for DynamoDB with Lambda in Python

How It Works

Kiro IDE → spawns uvx process → awslabs.aws-iac-mcp-server (stdio)
                                       ↓
                          CDK Knowledge Base + cfn-lint + cfn-guard + AWS APIs

The Power runs uvx awslabs.aws-iac-mcp-server@latest. Communication happens over stdin/stdout (MCP stdio transport). No Docker required, no custom server code.

Available Tools (9)

Tool Purpose Credentials
search_cdk_documentation Search CDK API Reference, Best Practices, CDK-NAG rules No
search_cdk_samples_and_constructs Find Python CDK code samples and constructs No
cdk_best_practices Get comprehensive CDK best practices guide No
search_cloudformation_documentation Search CloudFormation resource types and properties No
validate_cloudformation_template Validate template syntax/schema via cfn-lint No
check_cloudformation_template_compliance Security compliance check via cfn-guard No
read_iac_documentation_page Read full AWS documentation pages No
get_cloudformation_pre_deploy_validation_instructions Pre-deployment change set guidance No
troubleshoot_cloudformation_deployment Analyze failed stack deployments with CloudTrail Yes

Hooks (Automation)

Hook Trigger Action
validate-on-synth Template file created Offers to run cfn-lint + cfn-guard validation
check-cdk-best-practices CDK Python file edited Quick best-practices review
pre-deploy-check Shell command (cdk deploy) Reminds to validate before deploying

Project Structure

kiro-powers-aws-iaac/
├── POWER.md              # Power metadata and onboarding instructions
├── README.md             # This file
├── mcp.json              # MCP server config (awslabs.aws-iac-mcp-server via uvx)
├── steering/
│   ├── python-cdk-conventions.md    # Project structure, coding patterns, anti-patterns
│   ├── cdk-validation-workflow.md   # Synth → validate → comply → deploy pipeline
│   └── cdk-security-checklist.md    # Security review checklist with CDK-NAG
├── hooks/
│   ├── validate-on-synth.json
│   ├── check-cdk-best-practices.json
│   └── pre-deploy-check.json
└── templates/
    └── cdk-project/                 # Production-ready CDK scaffold
        ├── app.py
        ├── cdk.json
        ├── requirements.txt
        ├── config/environments.py
        ├── stacks/example_stack.py
        └── tests/test_example_stack.py

Using with AIDLC Orchestrator

If you're using kiro-powers-aidlc, register this power in your project-config.md:

| infrastructure | aws-cdk-python | Infrastructure design, CDK/Python code generation |

The orchestrator activates this power during Infrastructure Design and Code Generation stages.

Troubleshooting

Error Cause Fix
command not found: uvx uv not installed Install from https://docs.astral.sh/uv/getting-started/installation/
MCP server won't start Python unavailable uv python install 3.10
401 on troubleshoot AWS creds missing aws configure or set AWS_PROFILE
Slow first start uvx downloading package Normal first time (~30s), cached after

License

MIT

kiro-powers-aws-iaac

Kiro Power for AWS Infrastructure as Code - Python CDK with CloudFormation validation, security compliance, and best-practice patterns.

Included Powers

kiro-powers-aws-cdk-python

A dedicated Kiro Power wrapping the official awslabs.aws-iac-mcp-server with Python CDK focus.

What it provides:

Layer Contents
MCP Server awslabs.aws-iac-mcp-server — 9 tools for CDK docs, samples, validation, compliance, troubleshooting
Steering Python CDK conventions (auto-loads on *.py), validation workflow (on cdk.json), security checklist (manual)
Hooks Auto-validate on synth, best-practice check on save, pre-deploy gate
Templates Production-ready CDK project scaffold with cdk-nag, multi-env config, pytest tests

Quick start:

Register in your project-config.md Installed Powers Registry:

| infrastructure | kiro-powers-aws-cdk-python | Infrastructure design, CDK/Python code generation |

The AIDLC orchestrator activates this power automatically during Infrastructure Design and Code Generation stages.

See .kiro/powers/kiro-powers-aws-cdk-python/README.md for full documentation.

Why This MCP Server?

The awslabs.aws-iac-mcp-server is the official AWS IaC MCP server from the awslabs/mcp monorepo. It was chosen because:

  1. Official & maintained — Part of the AWS Labs open source MCP collection
  2. Complete CDK lifecycle — Research → code → synth → validate → deploy → troubleshoot
  3. Python first-class — Code samples support language: "python" filtering
  4. No credentials needed for 90% of workflows (docs, validation, compliance)
  5. Security baked in — cfn-lint + cfn-guard + CDK-NAG knowledge base
  6. Latest docs — Always-current CDK API reference and construct documentation

About

Kiro Power for AWS Infrastructure as Code - Python CDK with CloudFormation validation, security compliance, and medallion architecture patterns.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages