Class Ec2MetadataConfigProvider

java.lang.Object
software.amazon.awssdk.imds.internal.Ec2MetadataConfigProvider

public final class Ec2MetadataConfigProvider extends Object
Endpoint Provider Class which contains methods for endpoint resolution.
  • Method Details

    • instance

      public static Ec2MetadataConfigProvider instance()
    • resolveEndpoint

      public String resolveEndpoint(EndpointMode endpointMode)
      Resolve the endpoint to be used for the DefaultEc2MetadataClient client. Users may manually provide an endpoint through the AWS_EC2_METADATA_SERVICE_ENDPOINT environment variable or the ec2_metadata_service_endpoint key in their aws config file. If an endpoint is specified is this manner, use it. If no values are provided, the defaults to:
      1. If endpoint mode is set to IPv4: "http://169.254.169.254"
      2. If endpoint mode is set to IPv6: "http://[fd00:ec2::254]"
      (the default endpoint mode is IPV4).
      Parameters:
      endpointMode - Used only if an endpoint value is not specified. If so, this method will use the endpointMode to choose the default value to return.
      Returns:
      the String representing the endpoint to be used,
    • resolveEndpointMode

      public EndpointMode resolveEndpointMode()
    • resolveProfile

      public Optional<Profile> resolveProfile()
    • resolveServiceTimeout

      public Duration resolveServiceTimeout()
      Resolve the service timeout value to be used for the DefaultEc2MetadataClient. Users may provide the timeout value through the `AWS_METADATA_SERVICE_TIMEOUT` environment variable or the `metadata_service_timeout` key in their AWS config file.
      Returns:
      the resolved service timeout as a Duration.
    • builder

      public static Ec2MetadataConfigProvider.Builder builder()