Class MetadataUtil

java.lang.Object
com.hazelcast.aws.utility.MetadataUtil

public final class MetadataUtil
extends Object
  • Field Details

    • INSTANCE_METADATA_URI

      public static final String INSTANCE_METADATA_URI
      This IP is only accessible inside AWS and is used to fetch metadata of running EC2 Instance. Outside connection is only possible with the keys. See details at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html.
      See Also:
      Constant Field Values
    • IAM_SECURITY_CREDENTIALS_URI

      public static final String IAM_SECURITY_CREDENTIALS_URI
      Post-fix URI to fetch IAM role details
      See Also:
      Constant Field Values
    • AVAILABILITY_ZONE_URI

      public static final String AVAILABILITY_ZONE_URI
      Post-fix URI to fetch availability-zone info.
      See Also:
      Constant Field Values
  • Method Details

    • retrieveMetadataFromURI

      public static String retrieveMetadataFromURI​(String uri, int timeoutInSeconds)
      Performs the HTTP request to retrieve AWS Instance Metadata from the given URI.
      Parameters:
      uri - the full URI where a `GET` request will retrieve the metadata information, represented as JSON.
      timeoutInSeconds - timeout for the AWS service call
      Returns:
      The content of the HTTP response, as a String. NOTE: This is NEVER null.
    • retrieveMetadataFromURI

      public static String retrieveMetadataFromURI​(String uri, int timeoutInSeconds, int retries)
      Performs the HTTP request to retrieve AWS Instance Metadata from the given URI.
      Parameters:
      uri - the full URI where a `GET` request will retrieve the metadata information, represented as JSON.
      timeoutInSeconds - timeout for the AWS service call
      retries - number of retries in case the AWS request fails
      Returns:
      The content of the HTTP response, as a String. NOTE: This is NEVER null.
    • getAvailabilityZone

      public static String getAvailabilityZone​(int connectionTimeoutSeconds, int connectionRetries)