Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing AWS SSM Parameters in NodeJS

I'm trying to get the ssm parameter inside my nodejs project, is IAM credentials I and wrote a test in my elastic beanstalk instance and works. The problem is inside the project. Any ideas why?

// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');

AWS.config.update({region: 'us-east-1'});

var ssm = new AWS.SSM();

var options = {
  Name: '/test/test', /* required */
  WithDecryption: false
};
var parameterPromise =  ssm.getParameter(options).promise();

parameterPromise.then(function(data, err) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

like image 598
Otavio Carvalho Avatar asked Oct 30 '19 22:10

Otavio Carvalho


1 Answers

I discovered, the same of this https://github.com/localstack/localstack/issues/1107

need to pass the region in the SSM constructor

var ssm = new AWS.SSM({region: 'us-east-1'});

seems to be a bug

tks

like image 78
Otavio Carvalho Avatar answered Oct 16 '22 11:10

Otavio Carvalho