AWS Region selection
You can access AWS services that operate in a specific geographic area by using AWS Regions. This can be useful both for redundancy and to keep your data and applications running close to where you and your users access them. For more information on how Regions are used, see AWS Region in the AWS SDKs and Tools Reference Guide.
Important
Most resources reside in a specific AWS Region and you must supply the correct Region for the resource when using the SDK.
AWS Region provider chain
The following lookup process is used when loading a service client's configuration from the execution environment. The first value that the SDK finds set is used in the configuration of the client. For more information on creating service clients, see Configure a client from the environment.
-
Any explicit Region set programmatically.
-
The
AWS_REGION
environment variable is checked.-
If you are using the AWS Lambda service, this environment variable is set automatically by the AWS Lambda container.
-
-
The
region
property in the shared AWSconfig
file is checked.-
The
AWS_CONFIG_FILE
environment variable can be used to change the location of the sharedconfig
file. To learn more about where this file is kept, see Location of the sharedconfig
andcredentials
files in the AWS SDKs and Tools Reference Guide. -
The
AWS_PROFILE
environment variable can be used to select a named profile instead of the default. To learn more about configuring different profiles, see Sharedconfig
andcredentials
files in the AWS SDKs and Tools Reference Guide.
-
-
The SDK attempts to use the Amazon EC2 Instance Metadata Service to determine the Region of the currently running Amazon EC2 instance.
-
The AWS SDK for Rust only supports IMDSv2.
-