Class AwsCurrentRegionHolder


  • public final class AwsCurrentRegionHolder
    extends Object
    Caches the result of calling Regions.getCurrentRegion() since accessing EC2 instance metadata repeatedly can result in being throttled and prevent other metadata accessing operations such as refreshing instance credentials from working normally
    • Method Detail

      • getCurrentRegionFromEC2Metadata

        public static com.amazonaws.regions.Region getCurrentRegionFromEC2Metadata()
                                                                            throws IllegalStateException
        Attempts to resolve the current region from EC2's instance metadata through Regions.getCurrentRegion(). If no region is able to be resolved an exception is thrown
        Throws:
        IllegalStateException