Understanding the “EB Config” sub-command
The goal of the blog post below is aid a user in better understanding the “EB Config” sub-command – to be perfectly blunt, the eb config documentation does not actually provide enough information to allow a user to utilize the command effectively. A majority of my clients that do use the eb command line interface don’t actually use eb config to save configuration or to commit configuration to version control. Below I’ll describe each config option (
delete, list, get, put, save) and what that command actually does.
eb config save $environment_name
Saves a running environment’s configuration in two locations:
- An S3 Bucket.
- As a YAML file on your own computer.
For instance, if you have an application named “www” and an environment named “www-qa01”, you can save the configuration for this environment by running “
eb config save www-qa01.” The following will occur:
- User will be prompted to enter a name for the saved configuration – in this example, I’ll use www-qa01
- The configuration will be saved in S3 as
s3://elasticbeanstalk-us-west-2-187376578462/resources/templates/www/www-qa01(note that the bucket name depends on your region and account ID and the key name depends on the application name and saved configuration name you provided previously)
- The configuration will be copied from S3 to saved to local disk as
.elasticbeanstalk/saved_configs/www-qa01.cfg.yml(note that the filename depends on the saved configuration name you provided previously)
A before and after screenshot of running the
eb config savecommand: Before command – notice that the AWS Console displays no “Saved Configurations”: After command – notice that the
eb config save command has written a file to disk and that the AWS Console displays a saved configuration named “www-qa01.” Lastly – a diagram of how the eb config save command works:
eb config delete $environment_name
As an example, if I ran
eb config delete www-qa01, then the following would occur:
- The www-qa01 saved configuration object will be removed from S3. As an example, if I ran
eb config delete www-qa01, then the object
s3://elasticbeanstalk-us-west-2-187376578462/resources/templates/www/www-qa01would be deleted.
- As a result of deleting the www-qa01 saved configuration object from S3, the www-qa01 saved configuration will be removed from AWS Console
- The YAML configuration file will be removed from .elasticbeanstalk/saved_configs/www-qa01.cfg.yml
eb config get $environment_name
If I ran
eb config get www-qa01, then the following would occur:
- If exists, a saved configuration file will be copied from S3 (location:
s3://elasticbeanstalk-us-west-2-187376578462/resources/templates/www/www-qa01) to local disk at
eb config list
If I ran the eb config list, I will execute a “list” against the objects located at
eb config put $environment_name
Uploads the named saved configuration to an Amazon S3 bucket. As an example, if I ran
eb config put www-qa01, then the following would happen:
- A file named
.elasticbeanstalk/saved_configs/www-qa01.cfg.ymlwould be uploaded to S3 at the following location:
- As a result of a new object being uploaded to S3, the saved configuration will appear in the AWS Console.
You can also upload a specific file (if not in
.elasticbeanstalk/saved_configs/www-qa01.cfg.yml) by running the command as follows:
eb config put www-qa01 --cfg ~/path/to/saved_config/www-qa02.config.yml where
~/path/to/saved_config/www-qa02.config.yml is a path to a valid Elastic Beanstalk Configuration file.