You should set a default AWS Region that will be used for accessing AWS services with the AWS SDK for Java. For the best network performance, choose a region that’s geographically close to you (or to your customers). For a list of regions for each service, see here: https://docs.aws.amazon.com/general/latest/gr/rande.html (Regions and Endpoints) in the Amazon Web Services General Reference.
You can use similar techniques to setting credentials to set your default AWS region:
- Set the AWS Region in the AWS config file on your local system, located at:
- ~/.aws/config on Linux, macOS, or Unix
- C:\Users\USERNAME\.aws\config on Windows
+ This file should contain lines in the following format:
[default]
region = your_aws_region
Substitute your desired AWS Region (for example, “us-west-2”) for your_aws_region.
- Set the AWS_REGION environment variable.
On Linux, macOS, or Unix, use export:
export AWS_REGION=your_aws_region
On Windows, use set :
set AWS_REGION=your_aws_region
Where your_aws_region is the desired AWS Region name