Running database migrations

To fix the current issue with our application, we need to have a mechanism that allows us to run database migrations to create the required database schema and tables.  This must also happen on each application update, however this should only occur once per application update. For example, if you had multiple Elastic Beanstalk instances, you do not want migrations to run on each instance. Instead, you want migrations to run only once for each deployment.

The container_commands key that you were introduced to in the previous section includes a useful property called leader_only, which configures Elastic Beanstalk to only run the specified command on the leader instance. This is the first instance that becomes ...

Get Docker on Amazon Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.