Test AWS credentials using AWS CLI
Test AWS credentials using AWS CLI
Testing for AWS credentials is a straightforward operation.
Using get-caller-identity
There is a single API call that will always work regardless of permissions: GetCallerIdentity
1
aws sts get-caller-identity
Output:
1
2
3
4
5
{
"UserId": "AIDA...",
"Account": "123456789012",
"Arn": "arn:aws:iam::123456789012:user/thomas"
}
The Arn
value depends on the type of credentials, but mostly includes the human-friendly name.
In addition, checking the status is reliable: 0
for success, 255
for failure.
This post is licensed under CC BY 4.0 by the author.
Comments powered by Disqus.