/aws-cdk-examples

Example projects using the AWS CDK

Primary LanguageTypeScriptApache License 2.0Apache-2.0

AWS CDK Examples

This repository contains a set of example projects for the AWS Cloud Development Kit.

TypeScript examples

To run a TypeScript example, say my-widget-service:

$ npm install -g aws-cdk
$ cd typescript/my-widget-service
$ npm install
$ npm run build
$ cdk deploy  // Deploys the CloudFormation template

# Afterwards
$ cdk destroy
Example Description
api-cors-lambda-crud-dynamodb Creating a single API with CORS, and five Lambdas doing CRUD operations over a single DynamoDB
application-load-balancer Using an AutoScalingGroup with an Application Load Balancer
classic-load-balancer Using an AutoScalingGroup with a Classic Load Balancer
custom-resource Shows adding a Custom Resource to your CDK app
elasticbeanstalk Elastic Beanstalk example using L1 with a Blue/Green pipeline (community contributed)
ecs-cluster Provision an ECS Cluster with custom Autoscaling Group configuration
ecs-load-balanced-service Starting a container fronted by a load balancer on ECS
ecs-service-with-task-placement Starting a container ECS with task placement specifications
ecs-service-with-advanced-alb-config Starting a container fronted by a load balancer on ECS with added load balancer configuration
ecs-service-with-task-networking Starting an ECS service with task networking, allowing ingress traffic to the task but blocking for the instance
fargate-load-balanced-service Starting a container fronted by a load balancer on Fargate
fargate-service-with-auto-scaling Starting an ECS service of FARGATE launch type that auto scales based on average CPU Utilization
lambda-cron Running a Lambda on a schedule
my-widget-service Use Lambda to serve up widgets
resource-overrides Shows how to override generated CloudFormation code
static-site A static site using CloudFront
stepfunctions-job-poller A simple StepFunctions workflow
ecs-service-with-logging Starting a container fronted by a load balancer on Fargate
fargate-service-with-logging Starting a container fronted by a load balancer on Fargate

Java examples

To run the Java examples:

$ npm install -g aws-cdk
$ mvn compile
$ cdk deploy

# Afterwards
$ cdk destroy
Example Description
hello-world A demo application that uses the CDK in Java
lambda-cron Running a Lambda on a schedule

Python examples

To run a Python example, say my-widget-service:

$ npm install -g aws-cdk
$ cd python/my-widget-service
$ pip install -r requirements.txt    # Best to do this in a virtualenv
$ cdk deploy                         # Deploys the CloudFormation template

# Afterwards
$ cdk destroy
Example Description
application-load-balancer Using an AutoScalingGroup with an Application Load Balancer
classic-load-balancer Using an AutoScalingGroup with a Classic Load Balancer
custom-resource Shows adding a Custom Resource to your CDK app
ecs-cluster Provision an ECS Cluster with custom Autoscaling Group configuration
ecs-load-balanced-service Starting a container fronted by a load balancer on ECS
ecs-service-with-task-placement Starting a container ECS with task placement specifications
ecs-service-with-advanced-alb-config Starting a container fronted by a load balancer on ECS with added load balancer configuration
ecs-service-with-task-networking Starting an ECS service with task networking, allowing ingress traffic to the task but blocking for the instance
fargate-load-balanced-service Starting a container fronted by a load balancer on Fargate
fargate-service-with-auto-scaling Starting an ECS service of FARGATE launch type that auto scales based on average CPU Utilization
lambda-cron Running a Lambda on a schedule
stepfunctions A simple StepFunctions workflow

JavaScript examples

Select the following link to see how to install and run the example.

Example Description
aws-cdk-changelogs-demo A full serverless Node.js application stack deployed using CDK. It uses AWS Lambda, AWS Fargate, DynamoDB, Elasticache, S3, and CloudFront.

License

This library is licensed under the Apache 2.0 License.