code: private String getOwnerId() {
          APITrace.begin(this, "AWSCloud.getOwnerId");
          try {
              ProviderContext ctx = getContext();
  
              if( ctx == null ) {
                  return null;
              }
              Map<String, String> parameters = getStandardParameters(getContext(), EC2Method.DESCRIBE_SECURITY_GROUPS);
              EC2Method method;
              NodeList blocks;
              Document doc;
  
              method = new EC2Method(EC2Method.SERVICE_ID, this, parameters);
              try {
                  doc = method.invoke();
              } catch( EC2Exception e ) {
                  logger.error(e.getSummary());
                  throw new CloudException(e);
              }
              blocks = doc.getElementsByTagName("securityGroupInfo");
              for( int i = 0; i < blocks.getLength(); i++ ) {
                  NodeList items = blocks.item(i).getChildNodes();
  
                  for( int j = 0; j < items.getLength(); j++ ) {
                      Node item = items.item(j);
  
                      if( item.getNodeName().equals("item") ) {
                          NodeList attrs = item.getChildNodes();
                          for( int k = 0; k < attrs.getLength(); k++ ) {
                              Node attr = attrs.item(k);
                              if( attr.getNodeName().equals("ownerId") ) {
                                  return attr.getFirstChild().getNodeValue().trim();
                              }
                          }
                      }
                  }
              }
              return null;
          } catch( InternalException e ) {
          } catch( CloudException e ) {
          } finally {
              APITrace.end();
          }
          // Couldn't get the number for some reason
          return null;
      }
docs: Retrieve current account number using DescribeSecurityGroups. May not always be reliable but is better than
  nothing.
  
  @return current account number or null if not found