This repository contains practice code to provision infrastructure on Amazon Web Services (AWS) using the AWS Cloud Development Kit (CDK) and TypeScript. The code is based on the materials covered in the Get Started with AWS CDK tutorial by AWS.
The cdk.json
file tells the CDK Toolkit how to execute your app. When the app is deployed, it creates an Virtual Private Cloud (VPC) with two public-facing subnets, spread across two Availability Zones (AZ).
In a new terminal window, install the dependencies by running:
# Install AWS CDK globally
npm install -g aws-cdk
# Verify installation by checking version number of the AWS CDK
cdk --version
# Install TypeScript globally
npm install -g typescript
# Verify installation by checking version number of TypeScript
tsc --version
# Install Node packages in package.json
npm install
The npm run build
command compiles the TypeScript code into JavaScript code.
The npm run test
command performs the Jest unit tests.
The cdk synth
command synthesizes the stack defined in the app into a CloudFormation template.
The cdk diff
command compares the current version of the stack (and its dependencies) defined in the app with the already-deployed version(s) and displays a list of changes.
The cdk deploy
command deploys the stack to the default AWS account and region.
The cdk watch
command continuously monitors the CDK app's source files and assets for changes and immediately performs a deployment of the stack when a change is detected.
The cdk destroy
command destroys the stack by removing resources according to their deletion policy. This command should be ran when the stack is no longer needed.
- This repository is licensed under the MIT License.