Creating a CloudFormation custom resource
Although our application has been deployed and is running, we clearly have a problem in that we haven't run database migrations, which is a required deployment task. We already have dealt with running another deployment task, which is to collect static files, however database migrations should only be run as a single deployment task per deployment. For example, if you are deploying multiple instances of your service, you don't want to run migrations for each instance you deploy, you just want to run migrations once per deployment, regardless of the number of instances that are in service.
One obvious solution is to manually run migrations after each deployment, however ideally you want to fully automate your deployments and ensure you have a mechanism to automatically run migrations. CloudFormation does not provide a resource that allows you run one-off ECS tasks, however an extremely powerful feature of CloudFormation is the ability to create your...