Created
January 25, 2019 09:50
-
-
Save apal21/d8845882daffa8860c302b10acaee2a1 to your computer and use it in GitHub Desktop.
Sample code to assume role and generate temporary credentials using .then()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const sts = new AWS.STS(); | |
sts | |
.assumeRole({ | |
DurationSeconds: 3600, | |
ExternalId: '1234-1234-1234-1234-1234', | |
RoleArn: 'Your Role ARN', | |
RoleSessionName: 'abc', | |
}) | |
.promise() | |
.then(data => { | |
console.log(data); | |
}) | |
.catch(err => { | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment