A collection of CDK 2 demo projects in TypeScript, based off some projects I've done and lessons I've learned.
- lerna: this is a monorepo managed learn. Each lerna package can be deployed as a standalone AWS CloudFormation stack.
- Node.js 16.x:
- AWS CDK requires Node.js LTS releases.
- AWS Lambda runtime supports up to Node.js 16.x.
- Recommended using nvm to manage your local Node.js versions (see .nvmrc). For zsh users, plugin zsh-nvm can be handy.
- Typescript 4.x
- AWS CDK 2
- AWS SDK for JavaScript 3
- Prettier, ESlint, Commitlint, lint-staged
- Jest
- AWS services per system architecture diagrams
List available npm scripts and their descriptions here.
lint
: lint codebase with ESlintcommit
: preferred way to create a git committest
: run unit testsdeploy
: deploy all projectsdeploy:rest-api-ecs
: deploy REST API on ECS with Fargate
-
make sure your command line has sufficient access to the target AWS account. recommend Configuring the AWS CLI to use AWS IAM Identity Center (successor to AWS Single Sign-On).
-
bootstrap CDK in the target AWS account, if it hasn't been.
# deploy everything
npm run deploy
# deploy package @capturedlabs/rest-api-ecs
npx lerna run deploy --scope=@capturedlabs/rest-api-ecs
# deploy package @capturedlabs/rest-api-serverless
npx lerna run deploy --scope=@capturedlabs/rest-api-serverless