I'm trying to pull a parameter value from the Parameter Store using the following code:
let ssm = new AWS.SecretsManager();
emailParam = { Path: '/myPath/Service/DestinationEmail'};
destinationEmail = ssm.getParametersByPath(emailParam, function(err, data){
if(err){
console.log(err, err.stack);
} else {
return data;
}
});
}else {
destinationEmail = dev.destinationEmail;
}
I checked the version of the SDk which is running and the console logged out version 2.339.0 so I added this as an explicit reference in package.json dependencies "aws-sdk": "^2.339.0"
Whenever I deploy this lambda and perform a test of invoking the lambda I get the following exception:
TypeError: ssm.getParametersByPath is not a function at exports.handler
Looking at the API documentation the method I have written looks (to me) to be correct but I continue to get this exception.
Any suggestions on how to pull the parameter value out of the store and use if it within the lambda?
You're using the incorrect service. There's AWS Secrets Manager and AWS System Manager Parameter Store.
You're creating a client for the former, but using the API for the latter. Try using the SSM
client, I think that's what you're looking for.