Package com.hazelcast.aws.utility
Class MetadataUtil
java.lang.Object
com.hazelcast.aws.utility.MetadataUtil
public final class MetadataUtil extends Object
-
Field Summary
Fields Modifier and Type Field Description static String
AVAILABILITY_ZONE_URI
Post-fix URI to fetch availability-zone info.static String
IAM_SECURITY_CREDENTIALS_URI
Post-fix URI to fetch IAM role detailsstatic String
INSTANCE_METADATA_URI
This IP is only accessible inside AWS and is used to fetch metadata of running EC2 Instance. -
Method Summary
Modifier and Type Method Description static String
getAvailabilityZone(int connectionTimeoutSeconds, int connectionRetries)
static String
retrieveMetadataFromURI(String uri, int timeoutInSeconds)
Performs the HTTP request to retrieve AWS Instance Metadata from the given URI.static String
retrieveMetadataFromURI(String uri, int timeoutInSeconds, int retries)
Performs the HTTP request to retrieve AWS Instance Metadata from the given URI.
-
Field Details
-
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
Post-fix URI to fetch IAM role details- See Also:
- Constant Field Values
-
AVAILABILITY_ZONE_URI
Post-fix URI to fetch availability-zone info.- See Also:
- Constant Field Values
-
-
Method Details
-
retrieveMetadataFromURI
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
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 callretries
- 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
-