- VPC + 3 subnets (public, private, isolated)
- Cognito
- RDS Aurora Postgres + Proxy
- API Gateway HTTP
- Lambda
- Secrets Manager
- SSM Parameter Store
- VPC + 3 subnets (public, private, isolated)
- Cognito
- RDS Aurora Postgres + Proxy
- ALB
- ECS Fargate (ARM) + ECR + Auto-Scaling
- Secrets Manager
- SSM Parameter Store
npm i -g aws-cdk
npm i
cdk bootstrap
cdk deploy vpc
cdk deploy acm
cdk deploy cognito
cdk deploy db
cdk deploy api
-
Install AWS CDK
npm i -g aws-cdk cdk --version
-
Initialize a new project
cdk init app --language typescript npm i esbuild
Note:
esbuild
- used to build Node.js Lambda functions -
Bootstrap the AWS environment
cdk bootstrap
-
Deploy the stack
cdk deploy --all
or
cdk deploy api
bin
- Entry pointlib
- Stacks and Constructshelpers
- Reusable codefunctions
- Lambda functionsapi-chats
- Lambda function for API Gatewayshared
- Shared code between functions
-
Change Cognito user password
aws cognito-idp admin-set-user-password \ --user-pool-id <XXX> \ --region <XXX> \ --username <XXX> \ --password <XXX> \ --permanent
-
Get Cognito user JWT token
aws cognito-idp initiate-auth \ --client-id <XXX> \ --region <XXX> \ --auth-flow USER_PASSWORD_AUTH \ --auth-parameters USERNAME=<XXX>,PASSWORD=<XXX>