1 Answer
- Newest
- Most votes
- Most comments
1
Regions.getCurrentRegion()
does not have an equivalent in v2.
You could use the DefaultAwsRegionProviderChain
class that looks for the region in this order:
- Check the
aws.region
system property for the region. - Check the
AWS_REGION
environment variable for the region. - Check the
{user.home}/.aws/credentials
and{user.home}/.aws/config
files for the region. - If running in EC2, check the EC2 metadata service for the region.
var regionProvider = DefaultAwsRegionProviderChain.builder().build(); var region = regionProvider.getRegion();
answered 2 years ago
Relevant content
- asked 5 years ago
- asked 6 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago