Skip to content

Instantly share code, notes, and snippets.

@madan712
Created December 31, 2023 15:14
Show Gist options
  • Save madan712/2172bbb03865ffe57b7a90eba3d97e00 to your computer and use it in GitHub Desktop.
Save madan712/2172bbb03865ffe57b7a90eba3d97e00 to your computer and use it in GitHub Desktop.
AWS SDK javascript v3 assume role
const assumeRole = async (email) => {
console.log(`Assuming role`);
const param = {
RoleArn: QUICKSIGHT_ROLE_ARN,
RoleSessionName: email, // An unique identifier like email/username etc
DurationSeconds: 900,
};
const command = new AssumeRoleCommand(param);
const response = await stsClient.send(command);
console.log(JSON.stringify(response));
return getQuickSightClient(response.Credentials);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment