fix issue with conflicting EC2 permissions calling AWS STS

This commit is contained in:
Dave Horton
2023-11-29 14:17:46 -05:00
parent 1f0b9ff539
commit 906a6b52b8
+8 -7
View File
@@ -14,13 +14,14 @@ async function getAwsAuthToken(
if (obj) return {...obj, servedFromCache: true};
/* access token not found in cache, so generate it using STS */
const stsClient = new STSClient({ region: awsRegion });
const params = {
accessKeyId: awsAccessKeyId,
secretAccessKey: awsSecretAccessKey,
DurationSeconds: EXPIRY
};
const command = new GetSessionTokenCommand(params);
const stsClient = new STSClient({
region: awsRegion,
credentials: {
accessKeyId: awsAccessKeyId,
secretAccessKey: awsSecretAccessKey,
}
});
const command = new GetSessionTokenCommand({DurationSeconds: EXPIRY});
const data = await stsClient.send(command);
const credentials = {