npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ssmenv-cli

v0.6.3

Published

Manage environment variables with AWS SSM.

Downloads

30

Readme

ssmenv-cli

Version CircleCI Downloads/week License

Manage environment variables with AWS SSM from the command line.

Usage

$ npm install -g ssmenv-cli
$ ssmenv COMMAND
running command...
$ ssmenv (-v|--version|version)
ssmenv-cli/0.6.3 linux-x64 node-v8.11.1
$ ssmenv --help [COMMAND]
USAGE
  $ ssmenv COMMAND
...

After install run ssmenv init to generate configuration files for the project. The init command asks for AWS Access and Secret Keys, the intention is these are keys for an IAM user's account, these will identify which account makes changes to variables in the SSM Parameter Store. The configuration files are placed in the .ssmenv directory as public.json and private.json. public.json will only contain data that is not sensitive (such as project root path), it should be added to source control. private.json will contain sensitive data (such as AWS access key credentials) and should be ignored by source control.

Commands

In the following command examples lines beginning with ? indicate prompts for input.

ssmenv env STAGE

Generate .env compatible output from stored parameters.

USAGE
  $ ssmenv env STAGE

ARGUMENTS
  STAGE  Stage to use for retrieving data. Appended to root path.

OPTIONS
  --withDecryption  Attempt to decrypt parameters using accessible KMS keys.

EXAMPLES
  # Write test stage to STDOUT; assumes "FOO" and "foo" are set as vars.
  $ ssmenv env:dotenv test
  FOO=bar
  foo=baz

  # Write test stage to .env.test
  $ ssmenv env:dotenv test > .env.test

See code: src/commands/env.ts

ssmenv env:dotenv STAGE

Generate .env compatible output from stored parameters.

USAGE
  $ ssmenv env:dotenv STAGE

ARGUMENTS
  STAGE  Stage to use for retrieving data. Appended to root path.

OPTIONS
  --withDecryption  Attempt to decrypt parameters using accessible KMS keys.

EXAMPLES
  # Write test stage to STDOUT; assumes "FOO" and "foo" are set as vars.
  $ ssmenv env:dotenv test
  FOO=bar
  foo=baz

  # Write test stage to .env.test
  $ ssmenv env:dotenv test > .env.test

See code: src/commands/env/dotenv.ts

ssmenv env:list

List the known stages or environments, ignoring configured rootPath.

USAGE
  $ ssmenv env:list

DESCRIPTION
  A stage or environment is considered any path with a direct child path holding a value.

EXAMPLE
  # List out the full paths to all known stages.
  $ ssmenv env:list
  /client/project/dev
  /client/project/production
  /client/project/test
  /otherclient/test_project/production
  /otherproject/dev

See code: src/commands/env/list.ts

ssmenv help [COMMAND]

display help for ssmenv

USAGE
  $ ssmenv help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

ssmenv init [ROOTPATH] [AWSACCESS] [AWSSECRET]

Create the configuration files for your project.

USAGE
  $ ssmenv init [ROOTPATH] [AWSACCESS] [AWSSECRET]

ARGUMENTS
  ROOTPATH   Root path for the project.
  AWSACCESS  AWS Access Key Id to use when interacting with AWS API.
  AWSSECRET  AWS Secret Key to use when interacting with AWS API.

OPTIONS
  -q, --quiet        Suppress informative but unnecessary output.
  -s, --stage=stage  Stage to operate within. May be provided multiple times.

EXAMPLES
  # Create configuration with given parameters.
  $ ssmenv init --stage=production / FOO bar
  Configuration written to .ssmenv/public.json and .ssmenv/private.json.
  * Recommend adding .ssmenv/public.json to source control.
  * Recommend ignoring .ssmenv/private.json in source control.

  # Create configuration by using prompts.
  # The value inside parentheses will be used as the default.
  $ ssmenv init
  ? AWS Access Key ID
  ? AWS Secret Access Key
  ? Root Path (/)
  ? Comma Separated Stages (development,production,staging,test)
  Configuration written to .ssmenv/public.json and .ssmenv/private.json.
  * Recommend adding .ssmenv/public.json to source control.
  * Recommend ignoring .ssmenv/private.json in source control.

See code: src/commands/init.ts

ssmenv var KEY VALUE

Set the value of a variable. Creates it if it does not exist, creates a new version if it does.

USAGE
  $ ssmenv var KEY VALUE

ARGUMENTS
  KEY    Key to use when setting the variable; AKA variable name.
  VALUE  Value of the variable to set.

OPTIONS
  -d, --description=description  Description of the variable.
  -s, --stage=stage              Stage to operate within. May be provided multiple times.

EXAMPLES
  # Set value of FOO variable in test stage.
  $ ssmenv var:set --stage=test FOO bar

  # Set value of FOO variable for staging with a description.
  $ ssmenv var:set --stage=staging FOO "bar baz" --description="A description of FOO"

See code: src/commands/var.ts

ssmenv var:del KEY

Delete a variable.

USAGE
  $ ssmenv var:del KEY

ARGUMENTS
  KEY  Key to use when setting the variable; AKA variable name.

OPTIONS
  -s, --stage=stage  Stage to operate within. May be provided multiple times.

EXAMPLE
  # Delete variable FOO in test stage.
  $ ssmenv var:del --stage=test FOO

See code: src/commands/var/del.ts

ssmenv var:set KEY VALUE

Set the value of a variable. Creates it if it does not exist, creates a new version if it does.

USAGE
  $ ssmenv var:set KEY VALUE

ARGUMENTS
  KEY    Key to use when setting the variable; AKA variable name.
  VALUE  Value of the variable to set.

OPTIONS
  -d, --description=description  Description of the variable.
  -s, --stage=stage              Stage to operate within. May be provided multiple times.

EXAMPLES
  # Set value of FOO variable in test stage.
  $ ssmenv var:set --stage=test FOO bar

  # Set value of FOO variable for staging with a description.
  $ ssmenv var:set --stage=staging FOO "bar baz" --description="A description of FOO"

See code: src/commands/var/set.ts

ssmenv var:tag KEY

Add tags to a variable. Variable must exist.

USAGE
  $ ssmenv var:tag KEY

ARGUMENTS
  KEY  Key to use when setting the variable; AKA variable name.

OPTIONS
  -s, --stage=stage           Stage to operate within. May be provided multiple times.
  -t, --tag=TagName:TagValue  Tags to set on the variable as TagName:TagValue.

EXAMPLES
  # Set Client tag of FOO variable in test stage.
  $ ssmenv var:set test FOO --tag=Client:baz

  # Set multiple tags on FOO variable for staging.
  $ ssmenv var:set staging FOO --tag=Client:baz --tag=Environment:staging

See code: src/commands/var/tag.ts