@evokegroup/aws-ssm
Helper class for using the AWS SSM service
Class: EvokeAwsSsm
constructor(args)
region | string | | The AWS region |
Methods
getParameter(name, decrypt) ⇒ Promise<string>
Gets and caches a parameter from the parameter store.
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.
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.
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);
});