Bird
0
0

You run aws ec2 describe-instances --profile test and get an error: "Unable to locate credentials". Your ~/.aws/config contains:

medium📝 Debug Q7 of 15
AWS - CLI
You run aws ec2 describe-instances --profile test and get an error: "Unable to locate credentials". Your ~/.aws/config contains:
[profile test]
region=us-west-1

What is the most probable cause?
AThe region <code>us-west-1</code> is invalid
BThe <code>test</code> profile is missing credentials in the <code>~/.aws/credentials</code> file
CThe AWS CLI version is outdated
DThe <code>test</code> profile is not referenced in the config file
Step-by-Step Solution
Solution:
  1. Step 1: Check config vs credentials files

    The config file can specify region but credentials must be in ~/.aws/credentials.
  2. Step 2: Missing credentials cause error

    If credentials are missing for the profile, the CLI cannot authenticate and throws this error.
  3. Final Answer:

    The test profile is missing credentials in the ~/.aws/credentials file -> Option B
  4. Quick Check:

    Credentials must be present for profile authentication [OK]
Quick Trick: Config sets region; credentials file stores keys [OK]
Common Mistakes:
  • Assuming region causes credential errors
  • Ignoring credentials file existence
  • Blaming CLI version without checking credentials

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes