问题
I'm running an Aurora PostgreSQL (Serverless) cluster. After I deploy the infrastructure for the first time, and every time I re-deploy, I want to run database schema migrations (add tables, add columns).
How can I accomplish this?
Lambda is out of the question, as migrations may run for a long time.
Edit: clarified about schema migration
Thanks!
回答1:
The correct way to migrate it would be through using the AWS Database Migration Service.
You could create the resources in the CDK for this, then once its complete either run manually or create a customResource that will trigger the job for you.
回答2:
If you're looking for an example on migrating database schema in Aurora using custom resources. See a detailed example in this repository.
来源:https://stackoverflow.com/questions/63088820/how-to-perform-database-schema-migrations-after-deploying-with-aws-cdk