When the app is deployed in multiple regions in AWS, its useful to detect the region automatically without specifying the region by using a property/environment variable ourself.
We can detect the region by using the AWS SDK:
Regions.getCurrentRegion(); //returns Regions enum
Or by using:
EC2MetadataUtils.getEC2InstanceRegion(); //returns region String
Or:
System.getenv("AWS_REGION")
No comments :
Post a Comment
Your Comment and Question will help to make this blog better...