Skip to content

Instantly share code, notes, and snippets.

@madan712
Created December 31, 2023 15:18
Show Gist options
  • Save madan712/2c195dfe36726221472a0d9692b79f1d to your computer and use it in GitHub Desktop.
Save madan712/2c195dfe36726221472a0d9692b79f1d to your computer and use it in GitHub Desktop.
AWS SDK javascript v3 register new quicksight user
const registerUser = async (qsClient, email) => {
console.log(`Registering user`);
const param = {
IdentityType: "IAM",
Email: email,
UserRole: "READER",
IamArn: QUICKSIGHT_ROLE_ARN,
SessionName: email,
AwsAccountId: AWS_ACCOUNT_ID,
Namespace: "default"
};
const command = new RegisterUserCommand(param);
try {
const response = await qsClient.send(command);
console.log(JSON.stringify(response));
return response;
} catch (error) {
// registerUser need to be called only once on subsequent hit it will give error httpStatusCode: 409,
console.log(JSON.stringify(error));
return {};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment