aws-env

Create an execution environment from AWS secrets.

Usage no npm install needed!

<script type="module">
  import awsEnv from 'https://cdn.skypack.dev/aws-env';
</script>

README

aws-env

Create an execution environment from AWS secrets.

Installing

npm install -g aws-env

or

yarn global add aws-env

Usage

Usage: aws-env [options] [command]

Options:

  -V, --version       output the version number
  -h, --help          output usage information

Commands:

  get <...names>      Get one or more parameters
  set <name> <value>  Set a parameter
  help [cmd]          display help for [cmd]

Get environment

Get the content of the secrets aaa, bbb and ccc and output them as shell environment setters:

$ aws-env get aaa bbb ccc
export AAA="aaa"
export BBB="bbb"
export CCC="ccc"

To actually set the environment, you can simple evaluate the output of the script:

$ eval $(aws-env get ...)

You can also get the values as JSON or YAML:

$ aws-env get --format json ...
$ aws-env get --format yaml ...

Note that values that appear in later secrets override ones from earlier ones.

Set environment

Set a secret:

$ aws-env set aaa '{"x":"y"}'

FIXME Updating a secret currently fails.

TODO Read the value from STDIN.

Configuration

This program requires AWS credentials. There's several ways to configure it:

Environment

Set the credientials directly with the following environment variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION

AWS Credentials

Load credentials from ~/.aws/credentials by setting the following environment variables:

  • AWS_PROFILE (optional, defaults to default)
  • AWS_REGION

Additionally, if you want to also load your region from ~/.aws/config, omit AWS_REGION and set the following environment variable to a truthy value:

  • AWS_SDK_LOAD_CONFIG

License

MIT License

Author

Philipp Jardas · GitHub · Twitter