Class InstanceCredentialsProvider

  • All Implemented Interfaces:
    AwsCredentialsProvider

    public class InstanceCredentialsProvider
    extends java.lang.Object
    implements AwsCredentialsProvider
    An AwsCredentialsProvider that retrieves (temporary) credentials from the EC2 instance metadata service.

    The provider will retrieve and cache the credentials. Before each invocation of InstanceCredentialsProvier#getAwsCredentials(), the service will check whether the credentials need to be refreshed.

    See the Retrieving Security Credentials from Instance Metadata, and AWS Request Signing documentation.

    Created by Karel Maesen, Geovise BVBA on 07/02/17.

    • Constructor Detail

      • InstanceCredentialsProvider

        public InstanceCredentialsProvider​(java.lang.String roleName)
        Constructs an instance with the security credentials for the specified IAM role
        Parameters:
        roleName - the name of the IAM role to retrieve
      • InstanceCredentialsProvider

        public InstanceCredentialsProvider()
        Constructs an instance

        When constructing this instance the instance metadata services will be queried for available role names and the first role will be selected. This is same behavior as the AWS SDK.