1 Answer
- Newest
- Most votes
- Most comments
2
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.regionsystem property for the region. - Check the
AWS_REGIONenvironment variable for the region. - Check the
{user.home}/.aws/credentialsand{user.home}/.aws/configfiles 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 3 years ago
Relevant content
- asked 2 years ago
- asked 7 years ago
- AWS OFFICIALUpdated 2 years ago
