AWS Elastic Beanstalk environment dumper/extractor.
Project description
ebenv
AWS Elastic Beanstalk environment extractor/utility
This is a command line utility to manage environment variables from AWS Elastic Beanstalk app environments, to either re-use the same configuration locally or to import into another environment.
Currently two methods of extraction are supported, and one method to copy/sync variables between environments:
env
env
dumps environment variables in a key=value format, example:
$ ebenv env app-name app-env-name
AWS_ACCESS_KEY_ID=abcdefghijklmnopqrstvwuxyz
BUGSNAG_API_KEY=deadbeefdeadbeefdeadbeef
PARAM1=value
PARAM2=value
...
$ ebenv env app-name app-env-name > envfile
$ docker run --rm -it --env-file=envfile app/name
...
envdir
envdir
dumps environment variables into an envdir as used by tools such as
djb's envdir, runit's
chpst, or one of the other clones,
example:
$ ebenv envdir app-name app-env-name
found 4 vars, will write to '.env/*' [y/N]: n
Exiting..
envdir
will prompt before writing any files or creating the directory, and
a --target_dir
option can be specified:
$ ebenv envdir app-name app-env-name --target_dir=.ebenv-copy
found 4 vars, will write to '.ebenv-copy/*' [y/N]: y
.ebenv-copy did not exists, creating
$ ls .ebenv-copy/
AWS_ACCESS_KEY_ID BUGSNAG_API_KEY PARAM1 PARAM2
A simple grep
can verify that the env files contain the desired data:
$ grep . .ebenv-copy/*
.ebenv-copy/AWS_ACCESS_KEY_ID:abcdefghijklmnopqrstvwuxyz
.ebenv-copy/BUGSNAG_API_KEY:deadbeefdeadbeefdeadbeef
.ebenv-copy/PARAM1:value
.ebenv-copy/PARAM2:value
copy
copy
copies the environment variables from one environment within an EB app
to another environment in the same app. Can optionally be used to remove vars
from the destination environment, that are not found in the source environment.
$ ebenv copy app-name app-env-name new-app-env-name
Source environment 'app-env-name' has 22 options
Performing environment update...
Done, please check your EB web console to see the environment update progress
Right now copy
will overwrite any values in the destination environment for
keys found in the source environment. If you specify the --remove
option,
it will remove any keys in the destination environment not found in the source
environment.
$ ebenv copy app-name app-env-name new-app-env-name
Source environment 'app-env-name' has 22 options
Will remove 2 options from destination environment 'new-app-env-name'
...
This command is potentially very dangerous and destructive at this point,
especially if --remove
is used. Use with care.
Setup
$ make
virtualenv venv
New python executable in /Users/ses/w/ebenv/venv/bin/python2.7
Also creating executable in /Users/ses/w/ebenv/venv/bin/python
Installing setuptools, pip, wheel...done.
venv/bin/python setup.py develop
...
Now ebenv
is installed and available in the local venv
, and can be used
either by activating the virtualenv (source venv/bin/activate
) or by running
it directly from the venv: venv/bin/ebenv
.
Dependencies
ebenv
depends on boto3
and relies on boto3 being able to find standard AWS
credentials either via AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
env vars
in the local shell, or from ~/.aws/(config|credentials)
.
Future
Write more options for copy
, it might be useful to prompt for every
detected change, to allow finer-grained copying of variables. Maybe a
--dryrun
switch to show the intended deltas.
Other useful commands might include a way to set an environment based
on an env
file or an envdir
, basically the opposite of those two
commands in the utility right now.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ebenv-0.3.1.tar.gz
.
File metadata
- Download URL: ebenv-0.3.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02bb1ba8a291eaf1600d82ba7c768b4bb893957e98f2d5c4de0f0418fabeba11 |
|
MD5 | e31035f5d4550ec496f32cae0976268b |
|
BLAKE2b-256 | c3aa41a72ed5864831898b293e12ad03f0606452988174cc99d3761500a2024c |
File details
Details for the file ebenv-0.3.1-py2-none-any.whl
.
File metadata
- Download URL: ebenv-0.3.1-py2-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b517c35706a7e4609470d312363a27b0fec7101942ebd24ebf2b261ac80c92f |
|
MD5 | 4bf72f483761972959778470ebbfd574 |
|
BLAKE2b-256 | e2d5cdd0ab4bb0fddd392d2c1f8b86a21e1ed65054e2327d19ea6540e961d9b1 |