env.dev

AWS_DEFAULT_REGION

The default AWS region for CLI commands and SDK operations when no region is explicitly specified. Determines which AWS data center region API requests are sent to. Common values include us-east-1, eu-west-1, and ap-southeast-1.

Last updated:

AWS_DEFAULT_REGION is the older of two environment variables that set the AWS region. It was originally a CLI-only setting, while the SDKs read AWS_REGION. Modern AWS CLI v2 and current SDKs now understand both — but when both are set, AWS_REGION wins. If you only ever set one, set AWS_REGION; AWS_DEFAULT_REGION exists mainly for backwards compatibility with older tooling and Terraform's AWS provider, which historically read it.

Provider
AWS
Category
configuration
Set by
Set via aws configure, environment variable, or AWS config file
Example
us-east-1
Gotcha: The number-one region bug: AWS_REGION and AWS_DEFAULT_REGION are set to different values (often a stale AWS_DEFAULT_REGION left in a shell profile). AWS_REGION takes precedence, so commands quietly hit the wrong region while the variable you are reading says otherwise. Pick one — AWS_REGION — and unset the other.

How to set AWS_DEFAULT_REGION

bash

export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-instances

check for a conflicting pair

env | grep -E 'AWS_REGION|AWS_DEFAULT_REGION'

Frequently Asked Questions

AWS_REGION vs AWS_DEFAULT_REGION — which one should I use?

Use AWS_REGION. It is read by both the SDKs and AWS CLI v2, and it takes precedence when both are set. AWS_DEFAULT_REGION is the legacy CLI variable; keep it only if older tools in your stack still require it, and make sure it matches AWS_REGION to avoid sending requests to the wrong region.

Was this helpful?

Stay up to date

Get notified about new guides, tools, and cheatsheets.

Browse all 242 environment variables →