HADOOP-16930. Add hadoop-aws documentation for ProfileCredentialsProvider

Contributed by Nicholas Chammas.
This commit is contained in:
Nicholas Chammas 2020-03-25 06:39:35 -04:00 committed by GitHub
parent d353b30baf
commit 25a03bfece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -400,6 +400,31 @@ for credentials to access S3. Within the AWS SDK, this functionality is
provided by `InstanceProfileCredentialsProvider`, which internally enforces a provided by `InstanceProfileCredentialsProvider`, which internally enforces a
singleton instance in order to prevent throttling problem. singleton instance in order to prevent throttling problem.
### <a name="auth_named_profile"></a> Using Named Profile Credentials with `ProfileCredentialsProvider`
You can configure Hadoop to authenticate to AWS using a [named profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html).
To authenticate with a named profile:
1. Declare `com.amazonaws.auth.profile.ProfileCredentialsProvider` as the provider.
1. Set your profile via the `AWS_PROFILE` environment variable.
1. Due to a [bug in version 1 of the AWS Java SDK](https://github.com/aws/aws-sdk-java/issues/803),
you'll need to remove the `profile` prefix from the AWS configuration section heading.
Here's an example of what your AWS configuration files should look like:
```
$ cat ~/.aws/config
[user1]
region = us-east-1
$ cat ~/.aws/credentials
[user1]
aws_access_key_id = ...
aws_secret_access_key = ...
aws_session_token = ...
aws_security_token = ...
```
### <a name="auth_session"></a> Using Session Credentials with `TemporaryAWSCredentialsProvider` ### <a name="auth_session"></a> Using Session Credentials with `TemporaryAWSCredentialsProvider`
[Temporary Security Credentials](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) [Temporary Security Credentials](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html)