2 Answers
- Newest
- Most votes
- Most comments
4
It seems, you already configured user profile, then just run the command this way:
aws sts get-caller-identity --profile <profile_name>
You can find profile name for the configured user at ~/.aws/config file. If you want to export ACCESS_KEY and SECRET_ACCESS_KEY in environment then you can simply export those in environment and run command:
aws sts get-caller-identity
This would also return the same user identity.
Reference: How to configure AWS CLI
0
You can use the parameter --profile to use your current credentials set in aws confgure.
Check the links bellow to get more information: https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
answered 3 years ago
Relevant content
asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 6 months ago

Yes, I figured that out as soon as I posed this question. Please refer my other question https://repost.aws/questions/QUSFQA71KNTOOV13rPj-L9nw/aws-cli-commands-invalidclienttokenid-error that's what I'm trying to resolve.