ProfileCredentialsProvider
A CredentialsProvider that gets credentials from a profile in ~/.aws/config
or the shared credentials file ~/.aws/credentials
. The locations of these files are configurable via environment or system property on the JVM (see AwsSdkSetting.AwsConfigFile and AwsSdkSetting.AwsSharedCredentialsFile).
This provider is part of the DefaultChainCredentialsProvider and usually consumed through that provider. However, it can be instantiated and used standalone as well.
NOTE: This provider does not implement any caching. It will reload and reparse the profile from the file system when called. Use CachedCredentialsProvider to decorate the profile provider to get caching behavior.
This provider supports several credentials formats:
Credentials defined explicitly within the file
[default]
aws_access_key_id = my-access-key
aws_secret_access_key = my-secret
Assumed role credentials loaded from a credential source
[default]
role_arn = arn:aws:iam:123456789:role/RoleA
credential_source = Environment
Assumed role credentials from a source profile
[default]
role_arn = arn:aws:iam:123456789:role/RoleA
source_profile = base
[profile base]
aws_access_key_id = my-access-key
aws_secret_access_key = my-secret
Other more complex configurations are possible. See the Configuration and credential file settings documentation provided by the AWS CLI.
Parameters
Override the profile name to use. If not provided it will be resolved internally via environment (see AwsSdkSetting.AwsProfile) or defaulted to default
if not configured.
The AWS region to use, this will be resolved internally if not provided.
The platform API provider
the HttpClientEngine instance to use to make requests. NOTE: This engine's resources and lifetime are NOT managed by the provider. Caller is responsible for closing.
An optional configuration source to use for loading shared config. If not provided, it will be resolved from the environment.