@evokegroup/aws-ssm
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

@evokegroup/aws-ssm

Helper class for using the AWS SSM service

Class: EvokeAwsSsm

constructor(args)

Parameter Type Default Description
region string The AWS region

Methods

getParameter(name, decrypt) ⇒ Promise<string>

Gets and caches a parameter from the parameter store.

Parameter Type Default Description
name string The parameter name
decrypt boolean false Decrypt the parameter value

Returns: Promise<string>

When the Promise is resolved the parameter value will be returned.

Usage

const EvokeAwsSsm = require('@evokegroup/aws-ssm');

const ssm = new EvokeAwsSsm({
  region: 'us-east-1'
});

ssm.getParameter('myParameter', true)
.then((parameterValue) => {
  console.log(parameterValue);
})
.catch((ex) => {
  console.log(ex);
});

getParameters(names, decrypt) ⇒ Promise<object>

Gets and caches parameters from the parameter store.

Parameter Type Default Description
names Array<string> The parameter names
decrypt boolean false Decrypt the parameter value

Returns: Promise<object>

When the Promise is resolved an object containing the parameter names and values will be returned.

Usage

const EvokeAwsSsm = require('@evokegroup/aws-ssm');

const ssm = new EvokeAwsSsm({
  region: 'us-east-1'
});

ssm.getParameters(['myParameter', 'anotherParameter'], true)
.then((parameters) => {
  Object.keys(parameters).forEach((name) => {
    console.log(`${name} = ${parameters[name]}`);
  });
})
.catch((ex) => {
  console.log(ex);
});

getParametersByPath(path, settings) ⇒ Promise<Array<object>>

Gets and caches parameters from the parameter store.

Parameter Type Default Description
path string The parameter path
settings object {decrypt: false, recursive: true} Service call settings
settings.decrypt boolean false Decrypt the parameter value
settings.recursive boolean true Retrieve all parameters under the path

Returns: Promise<object>

When the Promise is resolved an object containing the parameter names and values will be returned.

Usage

const EvokeAwsSsm = require('@evokegroup/aws-ssm');

const ssm = new EvokeAwsSsm({
  region: 'us-east-1'
});

ssm.getParametersByPath('my/parameter/path', {decrypt: true, recursive: true})
.then((parameters) => {
  Object.keys(parameters).forEach((name) => {
    console.log(`${name} = ${parameters[name]}`);
  });
})
.catch((ex) => {
  console.log(ex);
});

Readme

Keywords

none

Package Sidebar

Install

npm i @evokegroup/aws-ssm

Weekly Downloads

0

Version

4.0.0

License

ISC

Unpacked Size

13.6 kB

Total Files

5

Last publish

Collaborators

  • ybevoke
  • jtsuyuki
  • evokejames
  • evoke-cjamodeo