EB Deploy to multiple environments
Solution 1:
To answer my own question. The AWS EB CLI 3+ has a nice interface to deploy to multiple environments. If you add another environment to your application you can simply deploy by using
eb deploy <environment-name>
Solution 2:
You can make the eb cli refer to different environments from different branches by adding config like the following to your .elasticbeanstalk/config.yml
file:
branch-defaults:
main:
environment: staging
production:
environment: production
In this example When you run eb deploy
from the "main" branch, it will deploy to your environment named "staging", whereas when you run it from the "production" branch, it will deploy to your environment named "production".
This approach requires each environment have a dedicated branch. To push one branch to multiple environments, you can use @adnan's answer and specify a branch when you use the eb deploy
command:
eb deploy <environment_name>
Solution 3:
If you specify the version label you can use that version in the other eb deploy
commands:
eb deploy my-first-env -l version-1 && eb deploy my-second-env --version version-1