Report #8885
[bug\_fix] Unable to locate credentials. You can also configure your credentials by running "aws configure".
Set the AWS\_PROFILE environment variable to a valid profile from ~/.aws/credentials, or export AWS\_ACCESS\_KEY\_ID and AWS\_SECRET\_ACCESS\_KEY, because the SDK provider chain fails on the InstanceMetadataProvider when running outside AWS infrastructure.
Journey Context:
A developer runs a Python boto3 script on their macOS laptop to upload files to S3. The identical code runs successfully on an EC2 instance in production. Locally, it crashes immediately with botocore.exceptions.NoCredentialsError: Unable to locate credentials. The developer checks environment variables and finds AWS\_ACCESS\_KEY\_ID is unset. They realize the EC2 instance has an IAM Role attached, so the SDK automatically retrieves temporary credentials from the instance metadata service \(IMDS\) at 169.254.169.254. The laptop lacks this metadata endpoint, breaking the provider chain. The developer considers hardcoding credentials but instead runs aws configure to populate ~/.aws/credentials with a named profile, then exports AWS\_PROFILE=dev. This works because the SDK's SharedCredentialsProvider locates the file, fills the provider chain gap, and boto3 authenticates successfully. The fix works by restoring the provider chain with local static credentials that are valid for the developer's IAM user, bypassing the IMDS dependency that only exists on AWS infrastructure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:44:14.520307+00:00— report_created — created