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-param-store-sdkv3

v4.0.0

Published

Library for loading parameters from AWS Parameter Store, forked from aws-param-store to use the awsdkv3

Downloads

3,583

Readme

npm version

aws-param-store

Module for loading parameter-store values from AWS SSM

Now updated to use the AWS SDK v3, only requiring the SSMClient module.

Features

  • Gets parameters by name(s) or path
  • Recursively resolves paths and decodes parameters by default
  • Paginates results automatically
  • Supports both synchronous and asynchronous querying of parameters
  • Uses Promises for asynchronous calls
  • Can run inside AWS Lambda environment
  • Lightweight and does not require additional dependencies other than the AWS-SDK

Installation

Install via npm.

npm install aws-param-store-sdkv3 --save

Getting Started

const awsParamStore = require( 'aws-param-store-sdkv3' );

awsParamStore.getParametersByPath( '/project1/service1/production' )
    .then( (parameters) => {

        // do something here
    });

If your AWS region is not set in your environment variables, then it can be set programmatically by supplying options when calling newQuery():

const awsParamStore = require( 'aws-param-store-sdkv3' );

awsParamStore.getParametersByPath( '/project1/service1/production', { region: 'us-east-1' } )
    .then( (parameters) => {

        // do something here
    });

API

Overview

Most API method calls in this library have both asynchronous and synchronous versions. When an asynchronous version is called, a Promise is returned to resolve the value once the operation completes. When an options parameter is allowed, it can be used to specify specific AWS service options such as the region. All of the getParameter* methods will request that the values are decoded. If you require further control, please use the parameterQuery() method.

getParameter( name [, options] )

Gets a parameter by name. This method returns a promise that resolves the Parameter.

const awsParamStore = require( 'aws-param-store-sdkv3' );

awsParamStore.getParameter( '/project1/my-parameter', { region: 'us-east-1' } )
    .then( (parameter) => {

        // Parameter info object for '/project1/my-parameter'
    });

getParameterSync( name [, options] )

Gets a parameter by name. This method will block until the operation completes.

const awsParamStore = require( 'aws-param-store-sdkv3' );

let parameter = awsParamStore.getParameterSync( '/project1/my-parameter',
											{ region: 'us-east-1' } );

// Parameter info object for '/project1/my-parameter'

getParameters( names [, options] )

Gets one or more parameters by name. This method returns a promise that resolves an object that contains Parameters and InvalidParameters.

const awsParamStore = require( 'aws-param-store-sdkv3' );

awsParamStore.getParameters( ['/project1/my-parameter1', '/project1/my-parameter2'],
							 { region: 'us-east-1' } )
    .then( (results) => {

        // results.Parameters will contain an array of parameters that were found
		// results.InvalidParameters will contain an array of parameters that were
		//                           not found
    });

getParametersSync( names [, options] )

Gets one or more parameters by name. This method will block until the operation completes, and will return an object that contains Parameters and InvalidParameters.

const awsParamStore = require( 'aws-param-store-sdkv3' );

let results = awsParamStore.getParametersSync( ['/project1/my-parameter1', '/project1/my-parameter2'],
							     			   { region: 'us-east-1' } );

// results.Parameters will contain an array of parameters that were found
// results.InvalidParameters will contain an array of parameters that were
//                           not found

getParametersByPath( path [, options] )

Gets parameters by recursively traversing the supplied path. This method returns a promise that resolves the parameters that were found.

const awsParamStore = require( 'aws-param-store-sdkv3' );

awsParamStore.getParametersByPath( '/project1' )
    .then( (parameters) => {

		// parameters contains an array of parameter objects
    });

getParametersByPathSync( path [, options] )

Gets parameters by recursively traversing the supplied path. This method will block until the operation completes, and will return a list of matching parameters.

const awsParamStore = require( 'aws-param-store-sdkv3' );

let parameters = awsParamStore.getParametersByPathSync( '/project1' );

// parameters contains an array of parameter objects

putParameter( name, value, type [, options] )

Puts parameter. This method returns a promise that resolves to the version returned back.

const awsParamStore = require( 'aws-param-store-sdkv3' );

awsParamStore.putParameter('key', 'value1,value2', 'StringList', {region: 'us-east-1', Overwrite: false})
    .then( (results) => {

		// results is the version of the value created
    });

putParameterSync( name, value , type [, options] )

Puts parameter. This method. This method will block until the version returned back.

const awsParamStore = require( 'aws-param-store-sdkv3' );

let results = awsParamStore.putParameterSync('key', 'securedstring', 'SecureString', {region: 'us-east-1'});

ParameterQuery

Instances of ParameterQuery can be created by calling parameterQuery( [options] ). This object is implementation behind the getParameter* methods, and allows further control over how the calls are made to resolve parameters.

ParameterQuery.path( p )

Sets the path name not be queried. Returns a reference to the ParameterQuery instance.

ParameterQuery.named( name )

Sets the name or names (if an array) to be queried. Returns a reference to the ParameterQuery instance.

ParameterQuery.decryption( enabled = true )

Indicates that the decryption of the values is enabled/disabled. Returns a reference to the ParameterQuery instance.

ParameterQuery.recursive( enabled = true )

Enables or disables recursive operations when resolving parameters by path. Returns a reference to the ParameterQuery instance.

ParameterQuery.execute()

Executes the query based on path or name(s) that were selected. Returns a Promise that resolves the parameter results.

ParameterQuery.executeSync()

Executes the query based on path or name(s) that were selected. This operation will block until complete.

License

BSD-3-Clause