@Immutable public final class AwsBasicCredentials extends Object implements AwsCredentials, ToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>
For more details on AWS access keys, see: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys
AwsCredentialsProvider| Modifier and Type | Class and Description |
|---|---|
static class |
AwsBasicCredentials.Builder
A builder for creating an instance of
AwsBasicCredentials. |
| Modifier | Constructor and Description |
|---|---|
protected |
AwsBasicCredentials(String accessKeyId,
String secretAccessKey)
Constructs a new credentials object, with the specified AWS access key and AWS secret key.
|
| Modifier and Type | Method and Description |
|---|---|
String |
accessKeyId()
Retrieve the AWS access key, used to identify the user interacting with AWS.
|
Optional<String> |
accountId()
Retrieve the AWS account id associated with this credentials identity, if found.
|
static AwsBasicCredentials.Builder |
builder() |
AwsBasicCredentials |
copy(Consumer<? super AwsBasicCredentials.Builder> modifier)
A convenience method for calling
ToCopyableBuilder.toBuilder(), updating the returned builder and then calling
SdkBuilder.build(). |
static AwsBasicCredentials |
create(String accessKeyId,
String secretAccessKey)
Constructs a new credentials object, with the specified AWS access key and AWS secret key.
|
boolean |
equals(Object o) |
int |
hashCode() |
Optional<String> |
providerName()
The name of the identity provider that created this credential identity.
|
String |
secretAccessKey()
Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.
|
AwsBasicCredentials.Builder |
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexpirationTimeprotected AwsBasicCredentials(String accessKeyId, String secretAccessKey)
accessKeyId - The AWS access key, used to identify the user interacting with AWS.secretAccessKey - The AWS secret access key, used to authenticate the user interacting with AWS.public static AwsBasicCredentials.Builder builder()
builder in interface AwsCredentialsIdentitypublic static AwsBasicCredentials create(String accessKeyId, String secretAccessKey)
create in interface AwsCredentialsIdentityaccessKeyId - The AWS access key, used to identify the user interacting with AWS.secretAccessKey - The AWS secret access key, used to authenticate the user interacting with AWS.public String accessKeyId()
accessKeyId in interface AwsCredentialsIdentitypublic String secretAccessKey()
secretAccessKey in interface AwsCredentialsIdentitypublic Optional<String> providerName()
providerName in interface Identitypublic Optional<String> accountId()
accountId in interface AwsCredentialsIdentitypublic AwsBasicCredentials.Builder toBuilder()
ToCopyableBuildertoBuilder in interface ToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>public AwsBasicCredentials copy(Consumer<? super AwsBasicCredentials.Builder> modifier)
ToCopyableBuilderToCopyableBuilder.toBuilder(), updating the returned builder and then calling
SdkBuilder.build(). This is useful for making small modifications to the existing object.copy in interface ToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>modifier - A function that mutates this immutable object using the provided builder.Copyright © 2026. All rights reserved.