7

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!

moltar
  • 1,372
  • 1
  • 11
  • 18
  • I would and will use this https://github.com/golang-migrate/migrate and execute the migration inside my CI/CD pipeline. I haven't build it yet so I can't give any specifics, it's next on my list after building the CI/CD in cdk with the new pipelines construct – Jonny Rimek Aug 05 '20 at 14:45

1 Answers1

0

If you're looking for an example on migrating database schema in Aurora using custom resources. See a detailed example in this repository.

Samuel James
  • 1,528
  • 16
  • 15
  • I think using Lambda is ok, but what about timeouts? What if the migration is expected to take a long time? I’ve settled on a similar approach, but using a fargate task instead. Thank you for your suggestion. – moltar Nov 14 '20 at 02:22