An example of running rambler migrations on deploy with the CDK.
This project sets up:
- a VPC
- an RDS Aurora Serverless cluster
- alternative 1: a Lambda function in the VPC with access to the cluster
- alternative 2: an ECS/Fargate task definition in the VPC with access to the cluster
The lambda migrator is an AWS NodeJS docker with rambler added. The lambda is triggered using a "Custom Resource" on deploy.
To avoid exposing passwords via environment variables there's a thin NodeJS wrapper that fetches the password from secrets manager and passes it to Rambler.
The ECS migrator is a Fargate task built from a vanilla alpine docker with rambler added. It is triggered on deploy using the cdk-fargate-run-task package (which most likely uses a custom resource, i.e. lambda, under the hood) which runs a one time task.
Based on the blank TS template.
The cdk.json file tells the CDK Toolkit how to execute your app.
npm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation template