I have the same codebase (one git repository) that I want to upload to multiple elastic beanstalk environments. Is there a way to do this, and if so how should I set up my repository in such a way that I can push to multiple environments?
The environments are different language versions of the site, that I want to run in different beanstalks. The language is set by the environment parameters.
Each environment runs only one application version at a time, however, you can run the same application version or different application versions in many environments simultaneously.
Description. Deploys the application source bundle from the initialized project directory to the running application. If git is installed, EB CLI uses the git archive command to create a . zip file from the contents of the most recent git commit command.
Instance type, root volume, key pair, and AWS Identity and Access Management (IAM) role. Internal Amazon RDS database.
In AWS Elastic Beanstalk, you can create a load-balanced, scalable environment or a single-instance environment. The type of environment that you require depends on the application that you deploy.
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>
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>
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With