code: @Nullable
  	private String getLocalAwsInstanceId() {
  		String detectedInstanceId = null;
  		try {
  			final URL metadataUrl = new URL("http://169.254.169.254/latest/meta-data/instance-id");
              URLConnection metadataConnection = metadataUrl.openConnection();
              BufferedReader in = new BufferedReader(new InputStreamReader(metadataConnection.getInputStream(), "UTF-8"));
              String inputLine;
              while ((inputLine = in.readLine()) != null) {
  				detectedInstanceId = inputLine;
  			}
  			in.close();
  		} catch (Exception e) {
  			logger.warn("unable to determine AWS instance ID", e);
  		}
  		return detectedInstanceId;
  	}
docs: Use the EC2 Metadata URL to determine the instance ID that this code is running on. Useful if you don't want to
  configure the instance ID manually. Pass detectInstance = "AWS" to have this run in your configuration.
  
  @return String containing an AWS instance id, or null if none is found