After each deployment on AWS, I have a specific npm script called db:migrate that I need to run. This script is responsible for executing the migrate.js file, which handles all database migrations.
Currently, my deployments are managed using AWS CloudFormation, but I'm uncertain about the best approach to incorporate a post-deployment script like npm run db:migrate.
I initially considered utilizing a cloudformation post deploy hook, but discovered only cloudformation custom resources. It seems possible to trigger a lambda function post-deployment, however, I am unsure how to connect to the ECS container from the lambda function to execute the db:migrate script.
If anyone has any insights or suggestions, they would be greatly appreciated.