@morningconsult/aws-assume-iam-role
v0.0.4
Published
Node.js package to assume an IAM role on AWS EC2
Downloads
10
Readme
aws-assume-iam-role
Node.js package to assume an IAM role on AWS EC2
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