Q: How do you run schema migrations in a serverless environment on AWS?
A: Use Cloudformation custom resources.
Cloudformation custom resources allow you to trigger a Lambda function at stack deployment time. For a primer on custom resources, check out this blog by Alex Debrie.
Here’s what you need
Because the schema migration is executed in a lambda function, you can use all the exiting ORM libraries you are familiar with, such as SQLAlchemy and Alembic for Python.
Check out this repo for a working example: https://github.com/murali44/RDS-Aurora-Serverless