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

aws-ssm-config-manager

v1.1.0

Published

A command line tool for managing .env files using AWS parameter store

Downloads

82

Readme

AWS SSM Config Manager

Description

A small tool for storing your .env files in AWS parameter store. Can be used by the team OR your CI/CD pipeline to pull the latest config files

Prerequisites

This tool uses the configuration from the AWS CLI. You can also configure profiles or command line environment variables

Installation

Yarn:
yarn add aws-ssm-config-manager

NPM: 
npm install aws-ssm-config-manager

Usage

There are three included functions in this package: push, pull and verify

Push

Push config from a local .env file to AWS SSM Parameter Store

ssm-config push

Pull

Pull config from AWS SSM Parameter Store and save to a local .env file.

ssm-config pull

Compare

Compare values between a local .env file and AWS SSM Parameter Store.

ssm-config compare

Using AWS Profiles

If you're using profiles with the AWS CLI you can provide the profile to use via the AWS_PROFILE environment variable. See More

Options

--help Display usage information about the tool or command.

--env, -e [string] [default .env] The path to the env file to use.

--prefix, -pf [string] [default /] The path prefix to use when storing the keys in the parameter store.

--keys, -k [array] [default []] An array of keys (separated by spaces) to filter down to. When keys are provided any keys that are not included will be skipped.

-r, --region [string] [default: "us-east-1"] The default AWS Region to use

--missingAwsAction [string] [choices: "keep", "remove"] [default: "keep"] When a key already exists in AWS but not in the local .env file. When pushing, should the key be kept or removed from AWS.

--missingLocalAction [string] [choices: "keep", "remove"] [default: "keep"] When a key exists locally, but is missing in AWS. When pulling, should the key be kept or removed locally.

--emptyKeyAction [string] [choices: "skip", "replace"] [default: "skip"] AWS SSM does not support empty strings. This will determine what to do with empty keys. They can either be skipped or replaced with a placeholder value.

--emptyKeyPlaceholder [string] [default: "[EMPTY]"] AWS SSM does not support empty strings. When the emptyKeyAction is replace, this will be the value used to replace the empty string.

--config, -c [default none] A path to a pre-configured config file to use instead of command-line flags. If a path is not provided it will default to checking aws-ssm.config.(json|js|ts) in the current directory. See below.

--verbose, -v[vv] [count] [default 0] The level of logging that the script should output, publishing different values at different levels

  1. Only display summary information at the conclusion of the script.
  2. Display keys that have changed
  3. Display all non-skipped keys
  4. Display all keys

The config file

All of the options above can also be configured in a standalone json (or js file with a default export). This can be useful if you're storing the configuration for multiple environments or packages in a single AWS SSM instance OR if you want your CI/CD tools to only pull the configuration that is required by them.

When using both a config file and command line instructions, the command-line values will override the values from the config file.

Example config.json

{
 "env": ".dev.env",
 "region": "us-east-1",
 "prefix": "/dev/config/"
}

Example config.js

const env = process.env.NODE_ENV || 'local';

/**
 * A smart config loader for AWS Parameter Store.
 * Depending on the NODE_ENV passed to the script it will load the appropriate configuation.
 */
module.exports = {
    region: 'us-east-1',
    env: `.${env}.env`,
    prefix: `/${env}/config/`
}