AWS parameter store access in lambda function

Viewed 6305

I'm trying to access the parameter store in an AWS lambda function. This is my code, pursuant to the documentation here: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SSM.html

var ssm = new AWS.SSM({apiVersion: '2014-11-06'});
var ssm_params1 = {
    Name: 'XXXX', /* required */
    WithDecryption: true
};

ssm.getParameter(ssm_params1, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     clientId = data.value;
});

Upon execution, I get the error:

"TypeError: ssm.getParameter is not a function"

Did amazon change this without changing the docs? Did this function move to another type of object?

4 Answers

There seems to be a bug in AWS that is not including correct sdk version in certain environments. This can be confirmed by logging the sdk version used.

console.log("AWS-SDK Version: " + require('aws-sdk/package.json').version);

Including the required aws-sdk package solved the problem for us.

Try adding the following in package.json:

    "aws-sdk": "^2.339.0"
Related