Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sts get-caller-identity for whoami #33

Closed
simonw opened this issue Nov 11, 2021 · 1 comment
Closed

Use sts get-caller-identity for whoami #33

simonw opened this issue Nov 11, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 11, 2021

I believe this will work even if you don't haveGetUser permission.

Saw this in https://aws-blog.de/2021/08/iam-what-happens-when-you-assume-a-role.html

https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html says:

No permissions are required to perform this operation. If an administrator adds a policy to your IAM user or role that explicitly denies access to the sts:GetCallerIdentity action, you can still perform this operation. Permissions are not required because the same information is returned when an IAM user or role is denied access.

@simonw simonw added the enhancement New feature or request label Nov 11, 2021
@simonw
Copy link
Owner Author

simonw commented Nov 18, 2021

New output:

% s3-credentials whoami
{
    "UserId": "AIDAWXFXAIOZDWC2E6I3G",
    "Account": "462092780466",
    "Arn": "arn:aws:iam::462092780466:user/simon-administrator"
}

@simonw simonw closed this as completed in 03417d9 Nov 18, 2021
simonw added a commit that referenced this issue Nov 18, 2021
simonw added a commit that referenced this issue Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant