- We want to deploy using our CI and so we can not use the interactive
eb init
You can suppress the interactive mode as follows:
eb init --platform <platform-name> --region <region-name> <application-name>
- Is it a good approach to commit the .elasticbeanstalk/config.yml inside the git repo of a project which uses eb deploy?
- Can someone explain how to deploy EB for multiple environments, without interaction?
By design, the EBCLI avoids committing the .elasticbeanstalk/
directory since it can contain developer-specific information, which when committed to VC can cause confusion. So, it's best avoided from VC. You are free to commit it to version control. Ensure there's no sensitive information here. Logs, and saved configurations are usually stored in .elasticbeanstalk/
.
- You can copy pertinent portions of the
.elasticbeanstalk/config.yml
file into root-level file from which CI could read information such as the environment name to use.
- Locally, you could create a pre-commit Git hook that would read the default environment name from the
.elasticbeanstalk/config.yml
file into the root-level file -- let's call it .environment_config.sh
. It could be a statement as simple as export BEANSTALK_ENVIRONMENT_NAME=<environment name from .elasticbeanstalk/config.yml>
On the CI server:
3.1. Ensure PWD is git init
-ed. Systems such as Jenkins usually are git init-ed
with the necessary branch, so CI can simply source .environment_config.sh
at this point and load the name of the environment to deploy.
3.2. eb init --platform <platform-name> --region <region-name> <application-name>
3.3. eb use $BEANSTALK_ENVIRONMENT_NAME
3.4. eb deploy
(You could combine 3.3. and 3.4. by performing eb deploy $BEANSTALK_ENVIRONMENT_NAME
instead; I just wanted to demonstrate the use of eb use
)