Class DefaultCredentialsProvider
java.lang.Object
software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider
- All Implemented Interfaces:
AutoCloseable,AwsCredentialsProvider,IdentityProvider<AwsCredentialsIdentity>,ToCopyableBuilder<DefaultCredentialsProvider.Builder,,DefaultCredentialsProvider> SdkAutoCloseable
public final class DefaultCredentialsProvider
extends Object
implements AwsCredentialsProvider, SdkAutoCloseable, ToCopyableBuilder<DefaultCredentialsProvider.Builder,DefaultCredentialsProvider>
AWS credentials provider chain that looks for credentials in this order:
- Java System Properties -
aws.accessKeyIdandaws.secretAccessKey - Environment Variables -
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY - Web Identity Token credentials from system properties or environment variables
- Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
- Credentials delivered through the Amazon EC2 container service if AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable,
- Instance profile credentials delivered through the Amazon EC2 metadata service
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classConfiguration that defines theDefaultCredentialsProvider's behavior. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Get a builder for defining aDefaultCredentialsProviderwith custom configuration.voidclose()static DefaultCredentialsProvidercreate()Returns the singleton instance of theDefaultCredentialsProviderusing the default configuration.ReturnsAwsCredentialsthat can be used to authorize an AWS request.Take this object and create a builder that contains all of the current property values of this object.toString()Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
identityType, resolveIdentityMethods inherited from interface software.amazon.awssdk.identity.spi.IdentityProvider
resolveIdentity, resolveIdentityMethods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
Method Details
-
create
Returns the singleton instance of theDefaultCredentialsProviderusing the default configuration. Configuration can be specified by creating an instance using thebuilder(). If you want to create a new instance, usebuilder()instead. -
builder
Get a builder for defining aDefaultCredentialsProviderwith custom configuration. -
resolveCredentials
Description copied from interface:AwsCredentialsProviderReturnsAwsCredentialsthat can be used to authorize an AWS request. Each implementation of AWSCredentialsProvider can choose its own strategy for loading credentials. For example, an implementation might load credentials from an existing key management system, or load new credentials when credentials are rotated.If an error occurs during the loading of credentials or credentials could not be found, a runtime exception will be raised.
- Specified by:
resolveCredentialsin interfaceAwsCredentialsProvider- Returns:
- AwsCredentials which the caller can use to authorize an AWS request.
-
close
public void close()Description copied from interface:SdkAutoCloseable- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
toString
-
toBuilder
Description copied from interface:ToCopyableBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToCopyableBuilder<DefaultCredentialsProvider.Builder,DefaultCredentialsProvider> - Returns:
- a builder for type T
-