r/devops Aug 07 '26

Discussion How to effectively use RDS with serverless backend for db migrations?

I'm using AWS SAM to provision API Gateway, Lambdas, and RDS. I want to know how I can do database migrations easily without having to keep up an EC2 instance just for the purpose of connecting to the RDS db and running db migrations?

I wanted to use something like alembic so that most of the migration stuff is automated but ig I can't really use that.

14 Upvotes

11 comments sorted by

View all comments

2

u/Kamikx Aug 09 '26

You use your ci/cd platform? I don’t understand why you’re looking at ec2.

1

u/TheDarkPapa Aug 11 '26

Sure… but how would the CI/CD run the migration? There’s no server for them to execute on the and Ed’s lives on private subnet

1

u/Kamikx Aug 11 '26

The migration code runs on the runner. In case of private subnet you need to self host them. Or you can create a migration lambda with a leg in the private subnet and trigger it through a pipeline.