AWS_REGION
The AWS region for SDK operations, taking precedence over AWS_DEFAULT_REGION when both are set. Used by all AWS SDKs to determine the service endpoint. This is the recommended environment variable for specifying region in application code.
Last updated:
AWS_REGION tells the AWS SDKs and CLI which regional endpoint to send requests to — us-east-1, eu-west-1, ap-southeast-2, and so on. It is the recommended way to set region in application code, and it takes precedence over the older AWS_DEFAULT_REGION when both are present. Inside Lambda and other AWS compute, AWS_REGION is set for you automatically and reflects where the function runs. Most 'works in one account, fails in another' issues trace back to region: an S3 bucket or DynamoDB table only exists in the region you created it in.
- Provider
- AWS
- Category
- configuration
- Set by
- Set via environment variable or application configuration
- Example
- eu-west-1
How to set AWS_REGION
bash
export AWS_REGION=eu-west-1
aws s3 lsNode.js SDK v3
import { S3Client } from '@aws-sdk/client-s3';
// reads AWS_REGION from the environment automatically
const s3 = new S3Client({});Docker
ENV AWS_REGION=eu-west-1References
Frequently Asked Questions
Do I need to set AWS_REGION inside AWS Lambda?
No. Lambda sets AWS_REGION automatically to the region the function runs in, and the SDK picks it up. You only set it yourself when running locally, in containers outside AWS, or to target a region different from the default.
Stay up to date
Get notified about new guides, tools, and cheatsheets.