Skip to content
aws-cdk logo

AWS CDK Skill

aws-cdk

AWS Cloud Development Kit infrastructure as code patterns and best practices for serverless, containers, and cloud-native applications

SKILL.md

Full skill instructions

AWS CDK Skill

Infrastructure as Code (IaC) using AWS Cloud Development Kit with TypeScript/​Python for building scalable cloud applications.

When to Use This Skill

Activate this skill when the user:

  • Requests AWS infrastructure setup
  • Needs serverless application architecture
  • Wants to define cloud resources as code
  • Mentions "AWS CDK", "infrastructure as code", "CloudFormation", "serverless"
  • Requires best practices for AWS resource management
  • Asks about container orchestration (ECS, EKS)
  • Needs API Gateway, Lambda, DynamoDB patterns

Core Capabilities

1. Common CDK Patterns

  • Serverless API: API Gateway + Lambda + DynamoDB
  • Static Website: S3 + CloudFront + Route53
  • Container Service: ECS Fargate + ALB + RDS
  • Event-Driven: EventBridge + Lambda + SQS/​SNS
  • Data Pipeline: S3 + Lambda + Glue + Athena
  • CI/​CD Pipeline: CodePipeline + CodeBuild + CodeDeploy

2. CDK Constructs

  • L1 (CloudFormation): Direct CFN resources
  • L2 (Curated): AWS construct library
  • L3 (Patterns): High-level patterns
  • Custom Constructs: Reusable components

3. Best Practices

  • Multi-environment deployment (dev, staging, prod)
  • Tagging and cost allocation
  • Security best practices (IAM, VPC, encryption)
  • Monitoring and logging (CloudWatch)
  • Resource cleanup and lifecycle management

Example Patterns

Serverless API Stack

import * as cdk from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/​aws-lambda';
import * as apigateway from 'aws-cdk-lib/​aws-apigateway';
import * as dynamodb from 'aws-cdk-lib/​aws-dynamodb';

export class ServerlessApiStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // DynamoDB Table
    const table = new dynamodb.Table(this, 'ItemsTable', {
      partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING },
      billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
      removalPolicy: cdk.RemovalPolicy.DESTROY,
    });

    // Lambda Function
    const handler = new lambda.Function(this, 'ItemsHandler', {
      runtime: lambda.Runtime.NODEJS_18_X,
      code: lambda.Code.fromAsset('lambda'),
      handler: 'index.handler',
      environment: {
        TABLE_NAME: table.tableName,
      },
    });

    table.grantReadWriteData(handler);

    // API Gateway
    const api = new apigateway.RestApi(this, 'ItemsApi', {
      restApiName: 'Items Service',
      description: 'This service manages items.',
    });

    const items = api.root.addResource('items');
    items.addMethod('GET', new apigateway.LambdaIntegration(handler));
    items.addMethod('POST', new apigateway.LambdaIntegration(handler));

    const item = items.addResource('{id}');
    item.addMethod('GET', new apigateway.LambdaIntegration(handler));
    item.addMethod('PUT', new apigateway.LambdaIntegration(handler));
    item.addMethod('DELETE', new apigateway.LambdaIntegration(handler));
  }
}

Static Website with CloudFront

import * as s3 from 'aws-cdk-lib/​aws-s3';
import * as cloudfront from 'aws-cdk-lib/​aws-cloudfront';
import * as s3deploy from 'aws-cdk-lib/​aws-s3-deployment';

export class StaticWebsiteStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // S3 Bucket
    const siteBucket = new s3.Bucket(this, 'SiteBucket', {
      websiteIndexDocument: 'index.html',
      websiteErrorDocument: 'error.html',
      publicReadAccess: true,
      removalPolicy: cdk.RemovalPolicy.DESTROY,
      autoDeleteObjects: true,
    });

    // CloudFront Distribution
    const distribution = new cloudfront.CloudFrontWebDistribution(this, 'SiteDistribution', {
      originConfigs: [{
        s3OriginSource: {
          s3BucketSource: siteBucket,
        },
        behaviors: [{ isDefaultBehavior: true }],
      }],
    });

    // Deploy site contents
    new s3deploy.BucketDeployment(this, 'DeployWebsite', {
      sources: [s3deploy.Source.asset('./​website')],
      destinationBucket: siteBucket,
      distribution,
      distributionPaths: ['/​*'],
    });

    new cdk.CfnOutput(this, 'DistributionDomainName', {
      value: distribution.distributionDomainName,
    });
  }
}

Best Practices

Do's

  • ✅ Use typed constructs (TypeScript recommended)
  • ✅ Separate stacks by lifecycle and team ownership
  • ✅ Tag all resources for cost tracking
  • ✅ Use environment variables for configuration
  • ✅ Implement proper IAM least privilege
  • ✅ Enable CloudWatch logs and metrics
  • ✅ Use CDK context for environment-specific values
  • ✅ Version lock your CDK dependencies

Don'ts

  • ❌ Don't hardcode sensitive values (use Secrets Manager)
  • ❌ Don't create circular dependencies between stacks
  • ❌ Don't forget to set removal policies
  • ❌ Don't ignore CDK security warnings
  • ❌ Don't deploy to production without testing

Resources

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
I
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View