Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix lambda_event AWS account_id query to work with AWS role #60645
Fixes lambda_event module to be able query AWS account id when AWS role is used for AWS access keys instead of AWS user.
I ran into an issue where the aws account query against IAM works when AWS credentials are gotten from a user but when I use a role I get error "botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the GetUser operation: Must specify userName when calling with non-User credentials". Looking at the sts docs https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html, the get_caller_identity function does not require any specific AWS permissions so I think it is a good alternative.