What is the AWS credential provider chain?
IntermediateConceptGlobal Infrastructure and IAM Basics
Answer
SDKs and the CLI look for credentials in a fixed order: explicit parameters, environment variables (AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN), shared config/credentials files and profiles (including SSO and role_arn), web identity token (AWS_WEB_IDENTITY_TOKEN_FILE, used by EKS and GitHub OIDC), container credentials (ECS task role), and finally the EC2 instance metadata service.
This is why a stray AWS_ACCESS_KEY_ID in a shell silently overrides the instance role. When debugging "wrong account" issues, run aws sts get-caller-identity first.
More on Global Infrastructure and IAM Basics
What is the difference between a Region, an Availability Zone and an edge location?BeginnerHow do you choose a Region for a workload?BeginnerWhat is the difference between an AZ name like `us-east-1a` and an AZ ID like `use1-az1`?IntermediateExplain the shared responsibility model.BeginnerWhat is the root user and how should you treat it?BeginnerWhat is the difference between an IAM user, group and role?Beginner