You can use DefaultAwsCredentialsProviderChain()
, which according to the documentation, looks for credentials in this order:
AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
(recommended since they are recognized by all AWS SDKs and CLI except for .NET), or AWS_ACCESS_KEY
and AWS_SECRET_KEY
(only recognized by the Java SDK)aws.accessKeyId
and aws.secretKey
~/.aws/credentials
) shared by all AWS SDKs and the AWS CLI