aws auth_error ai_generated true

botocore.exceptions.NoCredentialsError: Unable to locate credentials

ID: aws/no-credentials-error

Also available as: JSON · Markdown
90%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

AWS SDK can't find credentials. Missing env vars, config, or IAM role.

generic

Workarounds

  1. 95% success Configure credentials: aws configure, or set env vars, or use IAM role
    aws configure  # sets ~/.aws/credentials

    Sources: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

  2. 92% success In EC2/ECS/Lambda: use IAM role (no credentials needed)
    use IAM role (no credentials needed)

    Sources: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

Dead Ends

Common approaches that don't work:

  1. Hardcode credentials in source code 95% fail

    Security risk — credentials in git history

  2. Set AWS_ACCESS_KEY_ID in .env and commit 90% fail

    Same security risk as hardcoding

Error Chain

Preceded by: