-
Notifications
You must be signed in to change notification settings - Fork 646
Description
Describe the feature
We were getting a "Region is missing" error when doing this:
const ec2 = new EC2Client({
region: 'us-west-2',
credentials: fromTemporaryCredentials({
params: {
RoleArn: '...',
RoleSessionName: '...',
DurationSeconds: 3600,
},
masterCredentials: { ... },
}),
})
const { Images = [] } = await ec2.send(
new DescribeImagesCommand({ ImageIds: [ImageId] })
)This threw us for a loop, because region: 'us-west-2' is right there.
After a lot of debugging, turns out it's because the STSClient created by fromTemporaryCredentials doesn't get that region setting.
The workaround is to pass clientConfig: { region: 'us-west-2' } to fromTemporaryCredentials, but I don't think we should have to do this. It's not obvious that we need to do this since clientConfig is optional, the "Region is missing" error message only added to the confusion, and it took a lot of debugging to figure out what was actually the problem. Should be easier.
Use Case
Doing virtually anything with temporary credentials
Proposed Solution
fromTemporaryCredentials should somehow be able to get the region of the enclosing client it is passed as credentials to, so that we don't have to explicitly pass clientConfig: { region: ... }. This would be more user-friendly, ergonomic behavior.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
SDK version used
3.651.1
Environment details (OS name and version, etc.)
macOS Sonoma 14.4.1