Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAM role - session token expiring issue (question) #53

Open
ilamarang opened this issue Jun 25, 2018 · 0 comments
Open

IAM role - session token expiring issue (question) #53

ilamarang opened this issue Jun 25, 2018 · 0 comments

Comments

@ilamarang
Copy link

Hi,
I prefer to use a singleton connection for connecting to elastic search - We use an IAM role rather than IAM user for security reasons.

I'm receiving a 403 error after the session token expires - Does this library interact with aws-sdk to refresh tokens ? (or) is this something that should be handled outside of this library ?

var AWS = require('aws-sdk');
var config = require('config');
var connectionClass = require('http-aws-es');
var elasticsearch = require('elasticsearch');

AWS.config.getCredentials(function() {

AWS.config.update({
  credentials: new AWS.Credentials(AWS.config.credentials.accessKeyId,AWS.config.credentials.secretAccessKey,AWS.config.credentials.sessionToken),
  region: 'us-east-1'
});

}

)

var client = new elasticsearch.Client({
  host: `${config.get('elasticSearch.host')}`,
  log: 'debug',
  connectionClass: connectionClass,
  amazonES: {
    credentials: new AWS.EnvironmentCredentials('AWS')
  }
   
});

module.exports = client;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant