Markus Sadler PRO said over 5 years ago on AWS Security Groups and Deploying Rails 6 to Beanstalk :
Quick note on migrations: you can customize it, so migrations (any commands, really) are only run on one instance. You can configure that in the ebextensions, by using `leader_only`. (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-container-commands)