This is a project to create a new VPC, EC2 Auto Scaling group, Load Balancers and RDS instance on AWS with the AWS Cloud Development Kit.
This project:
- Create VPC in 5 tier layers of subnets: PUBLIC, PRIVATE and ISOLATED, you can specify the number of AZs and the CIDR.
- Create instance and NAT Gateway
- Create ALB, EC2 Autoscaling group with scaling policy, and custom EBS volume
- Create RDS instance (MySQL multi-AZ or Aurora)
- Create security group and allow access from the other security group:
- Using customized EC2 user data and specifying generated AMI properties with no need to specify the AMI id in every region
You can use cdk-dia to automatically produce an architecture diagram directly from CDK:
The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework to define cloud infrastructure in code and provision it through AWS CloudFormation.
It offers a high-level object-oriented abstraction to define AWS resources imperatively using the power of modern programming languages. Using the CDK’s library of infrastructure constructs, you can easily encapsulate AWS best practices in your infrastructure definition and share it without worrying about boilerplate logic.
For a detailed walkthrough, see the tutorial in the AWS CDK Developer Guide.
Install or update the [AWS CDK CLI] from npm (requires Node.js ≥ 14.15.0). We recommend using a version in Active LTS
npm i -g aws-cdk
cdk ls
list all stacks in the appcdk synth
emits the synthesized CloudFormation templatecdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk docs
open CDK documentation
https://github.com/aws-samples/aws-cdk-examples contains a set of example projects for the AWS Cloud Development Kit.
Its the official list of CDK example code. The repo is subdivided into sections for each language (see "Examples"). Each language has its own subsection of examples with the ultimate aim of complete language parity (same subset of examples exist in each language). These examples each provide a demonstration of a common service implementation, or infrastructure pattern that could be useful in your use of the CDK for building your own infrastructure.
This repo contains examples in each language supported by the CDK. Some languages are fully supported by JSII, but as additional languages are added, you will see those marked as Developer Preview
. You can find the examples for each of those languages at the following links:
Language | JSII Language-Stability |
---|---|
Typescript Examples | Stable |
Python Examples | Stable |
.NET Examples | Stable |
Java Examples | Stable |
Go Examples | Stable |
While this is an excellent learning resource for the CDK, there are other resources that can be referenced to assist with your learning/development process.