broamski / aws-mfa

Manage AWS MFA Security Credentials
MIT License
1.02k stars 165 forks source link

Added region as a parameter for aws-mfa. #77

Open shantanugupta opened 2 years ago

shantanugupta commented 2 years ago

Regarding the issue(https://github.com/broamski/aws-mfa/issues/76), I changed the code. Since I tested when calling sts API without region vs with region. Boto3 resolved to the correct API endpoint when the region was passed. So I made the change to the code to make the package accept region as an additional parameter.

Assumption: .aws/credentials file should contain the region as a required parameter.

abrockmeyer-govtact commented 1 year ago

Please allow this to merge into the repo. I too had this issue for govcloud

hmoffatt commented 1 year ago

This is also needed to work with S3 Multi Region Access Points, which don't work with temporary credentials from the global STS endpoint. https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiRegionAccessPointRestrictions.html

hmoffatt commented 1 year ago

The commit here is not enough, you must also set the endpoint_url when creating the client. See https://github.com/broamski/aws-mfa/pull/52 which has it working.