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.accessKeyId
andaws.secretAccessKey
- Environment Variables -
AWS_ACCESS_KEY_ID
andAWS_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
Modifier and TypeClassDescriptionstatic final class
Configuration that defines theDefaultCredentialsProvider
's behavior. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Get a builder for defining aDefaultCredentialsProvider
with custom configuration.void
close()
static DefaultCredentialsProvider
create()
Returns the singleton instance of theDefaultCredentialsProvider
using the default configuration.ReturnsAwsCredentials
that 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, wait
Methods inherited from interface software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
identityType, resolveIdentity
Methods inherited from interface software.amazon.awssdk.identity.spi.IdentityProvider
resolveIdentity, resolveIdentity
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
Method Details
-
create
Returns the singleton instance of theDefaultCredentialsProvider
using 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 aDefaultCredentialsProvider
with custom configuration. -
resolveCredentials
Description copied from interface:AwsCredentialsProvider
ReturnsAwsCredentials
that 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:
resolveCredentials
in interfaceAwsCredentialsProvider
- Returns:
- AwsCredentials which the caller can use to authorize an AWS request.
-
close
public void close()Description copied from interface:SdkAutoCloseable
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
-
toString
-
toBuilder
Description copied from interface:ToCopyableBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToCopyableBuilder<DefaultCredentialsProvider.Builder,
DefaultCredentialsProvider> - Returns:
- a builder for type T
-