public String getDefaultCredentials() throws IOException {
        String securityCredentialsList = readResource(SECURITY_CREDENTIALS_RESOURCE);

        securityCredentialsList = securityCredentialsList.trim();
        String[] securityCredentials = securityCredentialsList.split("\n");
        if (securityCredentials.length == 0) return null;

        String securityCredentialsName = securityCredentials[0];

        return readResource(SECURITY_CREDENTIALS_RESOURCE + securityCredentialsName);
    }
Connects to the Amazon EC2 Instance Metadata Service to retrieve the
default credential information (if any).

@return The response from the Amazon EC2 Instance Metadata Service, or
        null if no credential information was available.

@throws IOException
            If any problems are encountered while connecting to the
            Amazon EC2 Instance Metadata Service.
aws-java-sdk-core/src/main/java/com/amazonaws/internal/EC2MetadataClient.java