Amazon Web Services Region selection - Amazon SDK for Kotlin
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Web Services Region selection

With Amazon Web Services Regions, you can access Amazon Web Services 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:

  1. Any explicit Region set on the builder.

  2. The aws.region JVM system property is checked. If it’s set, that Region is used in the configuration of the client.

  3. The AWS_REGION environment variable is checked. If it’s set, that Region is used in the configuration of the client.

    1. Note: This environment variable is set by the Lambda container.

  4. The SDK checks the Amazon shared configuration file. If the region property is set for the active profile, the SDK uses it.

    1. The AWS_CONFIG_FILE environment variable can be used to customize the location of the shared config file.

    2. The aws.profile JVM system property or the AWS_PROFILE environment variable can be used to customize the profile that the SDK loads.

  5. The SDK attempts to use the Amazon EC2 Instance Metadata Service to determine the Region of the currently running EC2 instance.

  6. If the Region still isn’t resolved at this point, client creation fails with an exception.