Search code examples
amazon-web-servicesaws-cli

Get currently set profile in AWS CLI


I have a few profiles set up in my AWS configure file. How do I check what the current profile is set to?

I am not looking to get the value set on the profile: https://docs.aws.amazon.com/cli/latest/reference/configure/get.html

I am not looking for a list of profiles: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configure/list-profiles.html

Question: how do I check my currently active profile in AWS CLI?


Solution

  • A good sanity check I use is to run

    aws sts get-caller-identity
    

    Based on the docs:

    Returns details about the IAM user or role whose credentials are used to call the operation.

    Can give you a hint around which profile you currently have set