Library for loading parameters from AWS Parameter Store, forked from aws-param-store to use the awsdkv3
npm install aws-param-store-sdkv3
Module for loading parameter-store values from AWS SSM
Now updated to use the AWS SDK v3, only requiring the SSMClient module.
npm install aws-param-store-sdkv3 --save
``js
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():
`js
const awsParamStore = require( 'aws-param-store-sdkv3' );
awsParamStore.getParametersByPath( '/project1/service1/production', { region: 'us-east-1' } )
.then( (parameters) => {
// do something here
});
`
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 usedgetParameter*
to specify specific AWS service options such as the region. All of the methods will request that the values are decoded. If you requireparameterQuery()
further control, please use the method.
Gets a parameter by name. This method returns a promise that resolves the Parameter.
`js
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'
});
`
Gets a parameter by name. This method will block until the operation completes.
`js
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'
`
Gets one or more parameters by name. This method returns a promise that resolves
an object that contains Parameters and InvalidParameters.
`js
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
});
`
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.
`js
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
`
Gets parameters by recursively traversing the supplied path. This method returns
a promise that resolves the parameters that were found.
`js
const awsParamStore = require( 'aws-param-store-sdkv3' );
awsParamStore.getParametersByPath( '/project1' )
.then( (parameters) => {
// parameters contains an array of parameter objects
});
`
Gets parameters by recursively traversing the supplied path. This method will
block until the operation completes, and will return a list of matching
parameters.
`js
const awsParamStore = require( 'aws-param-store-sdkv3' );
let parameters = awsParamStore.getParametersByPathSync( '/project1' );
// parameters contains an array of parameter objects
`
Puts parameter. This method returns a promise that resolves to the version returned back.
`js
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
});
`
Puts parameter. This method. This method will block until the version returned back.
`js
const awsParamStore = require( 'aws-param-store-sdkv3' );
let results = awsParamStore.putParameterSync('key', 'securedstring', 'SecureString', {region: 'us-east-1'});
`
Instances of ParameterQuery can be created by calling parameterQuery( [options] ).getParameter*
This object is implementation behind the methods, and allows further
control over how the calls are made to resolve parameters.
Sets the path name not be queried. Returns a reference to the ParameterQuery
instance.
Sets the name or names (if an array) to be queried. Returns a reference to the
ParameterQuery instance.
Indicates that the decryption of the values is enabled/disabled. Returns a
reference to the ParameterQuery instance.
Enables or disables recursive operations when resolving parameters by path.
Returns a reference to the ParameterQuery` instance.
Executes the query based on path or name(s) that were selected. Returns a Promise
that resolves the parameter results.
Executes the query based on path or name(s) that were selected. This operation
will block until complete.