How to perform database schema migrations after deploying with AWS CDK?

痞子三分冷 提交于 2021-01-29 02:34:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!