code: public static String getAccountId() throws IOException {
          // Get the MAC address of the machine.
          String macUrl = getMetadataUrl() + "/network/interfaces/macs/";
          String mac = invokeUrl(macUrl).trim();
  
          // Use the MAC address to obtain the owner-id or the
          // AWS AccountId.
          String idUrl = macUrl + mac + "owner-id";
          String acctId = invokeUrl(idUrl).trim();
  
          assert  acctId != null;
          return acctId;
      }
docs: Returns the AccountId of the user who is running the instance.
  
  @return String       representing the AccountId or the owner-id
  @throws java.io.IOException  if failed to retrieve the AccountId using the
  Cloud infrastructure