0.0.4 • Published 8 years ago

@morningconsult/aws-assume-iam-role v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

aws-assume-iam-role

Node.js package to assume an IAM role on AWS EC2

npm package

Usage

The module exports a single function that is used to fetch IAM credentials from the EC2 metadata, and then configures the AWS SDK to use these credentials. It returns the newly configured AWS SDK instance if successful, otherwise it returns null (i.e. it was not run from an EC2 instance, or there is no IAM role on the instance).

const iam = require('aws-assume-iam-role');

iam().then(aws => {
  if (aws) {
    console.log('Assumed IAM role!');
  } else {
    console.log('No role assumed!');
  }
});

License

MIT License