Configure AWS account, cli, node, and typescript by following the link
npm install -g aws-cdk
cp .env.example .env
The cdk.json
file tells the CDK Toolkit how to execute your app.
RDS is hosted in a private subnet and the only way to access it is through the Bastion host, which is also limited to only SSM connection. To establish an SSM connection to the Bastion host, ensure you have the plugin installed:
brew install session-manager-plugin
Start a port forwarding session from your local machine to the RDS instance through the bastion host:
aws ssm start-session --target <bastion-instance-id> \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["5432"],"localPortNumber":["5432"]}'
Configure your DBMS tool to connect to localhost:5432
to access the RDS.
- Bootstrap CDK to prepare the repo for stack creation (only one time per account & region):
cdk bootstrap
cdk list
will give the list of stacks defined in the appcdk synth <StackName>
will synthesize specified stack from CDK to Cloudformation template files.cdk deploy <StackName>
deploys the specified stackcdk diff <StackName>
compare deployed stack with current statecdk destroy <StackName>
delete specified stack
aws ecr get-login-password --region $AWS_REGION --profile default | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
docker tag my-image:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/my-repo:latest
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/my-repo:latest