Skip to content
/ gorson Public

experiment with go and aws ssm parameter store

License

Notifications You must be signed in to change notification settings

pbs/gorson

Repository files navigation

Stability Main Workflow

Warning: experimental

This is an experimental library, and is currently unsupported.

Usage

gorson loads parameters from AWS ssm parameter store, and adds them as shell environment variables.

Download parameters from parameter store as a json file

gorson get /a/parameter/store/path/ > ./example.json
$ cat ./example.json

{
    "alpha": "the_alpha_value",
    "beta": "the_beta_value",
    "delta": "the_delta_value"
}

There's also a --format flag to pass in which format you want the parameters to export as.

gorson get --format yaml /a/parameter/store/path/ > ./example.yml
$ cat ./example.yml

alpha: "the_alpha_value"
beta: "the_beta_value"
delta: "the_delta_value"
gorson get --format env /a/parameter/store/path/ > ./.env
$ cat ./.env

alpha="the_alpha_value"
beta="the_beta_value"
delta="the_delta_value"

Load parameters as environment variables from a json file

source <(gorson load ./example.json)
$ env | grep 'alpha\|beta\|delta'
alpha=the_alpha_value
delta=the_delta_value
beta=the_beta_value

Upload parameters to parameter store from a json file

gorson put /a/parameter/store/path/ --file=./new-values.json

Delete parameter difference on put

$ gorson put /a/parameter/store/path/ --file=./different-values.json --delete

The following are not present in the file, but are in parameter store:
/a/parameter/store/path/gamma
Are you sure you'd like to delete these parameters?
Type yes to proceed:

Auto-approve prompts

If you would like to answer 'yes' to any prompts that require it, append --auto-approve.

Deactivate color

If you would prefer the output of commands to be colorless, append --no-color.

Installation

Currently gorson ships binaries for MacOS and Linux 64bit systems. You can download the latest release from GitHub

MacOS

wget https://github.com/pbs/gorson/releases/latest/download/gorson-darwin-amd64

Linux

Download the binary

wget https://github.com/pbs/gorson/releases/latest/download/gorson-linux-amd64

ARM

For either MacOS or Linux, replace the amd64 with arm64 above.

Install the binary

Move the binary to an installation path, make it executable, and add to path

mkdir -p /opt/gorson/bin
mv gorson-linux-amd64 /opt/gorson/bin/gorson
chmod +x /opt/gorson/bin/gorson
export PATH="$PATH:/opt/gorson/bin"

asdf

Install using asdf

Add asdf plugin

asdf plugin add gorson https://github.com/pbs/asdf-pbs.git

List available versions

asdf list-all gorson

Install a particular version

asdf install gorson 13

Make a particular version your default

asdf global gorson 13

Notes

These environment variables will affect the AWS session behavior:

https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html

AWS_PROFILE=example-profile AWS_REGION=us-east-1 gorson get /a/parameter/store/path/

Development

See docs/development.md