code: private URL getEc2MetadataServiceUrlForResource(String resourcePath) throws IOException {
          String endpoint = EC2_METADATA_SERVICE_URL;
          if (System.getProperty(EC2_METADATA_SERVICE_OVERRIDE_SYSTEM_PROPERTY) != null) {
              endpoint = System.getProperty(EC2_METADATA_SERVICE_OVERRIDE_SYSTEM_PROPERTY);
          }
  
          return new URL(endpoint + resourcePath);
      }
docs: Constructs a URL to the EC2 metadata service for the specified
  resource path.
  
  @param resourcePath
  The resource portion of the URL.
  
  @return A URL to the EC2 metadata service for the specified resource
  path.
  
  @throws IOException
  If a valid URL could not be constructed.