AWS Region selection
With AWS Regions, you can access AWS services that operate in a specific geographic area. This can be useful both for redundancy and to keep your data and applications running close to where you and your users will access them.
Default Region provider chain
When loading a service client’s configuration from the environment, the following lookup process is used:
-
Any explicit Region set on the builder.
-
The
aws.region
JVM system property is checked. If it’s set, that Region is used in the configuration of the client. -
The
AWS_REGION
environment variable is checked. If it’s set, that Region is used in the configuration of the client.Note: This environment variable is set by the Lambda container.
-
The SDK checks the AWS shared configuration file. If the
region
property is set for the active profile, the SDK uses it.-
The
AWS_CONFIG_FILE
environment variable can be used to customize the location of the shared config file. -
The
aws.profile
JVM system property or theAWS_PROFILE
environment variable can be used to customize the profile that the SDK loads.
-
-
The SDK attempts to use the Amazon EC2 Instance Metadata Service to determine the Region of the currently running EC2 instance.
-
If the Region still isn’t resolved at this point, client creation fails with an exception.