Skip to content

Commit aca67f5

Browse files
committed
HADOOP-16477: improve assumed role docs with troubleshooting on the KMSE problem.
Also changed `operation` on writes from `put` to `Writing Object` as that is what is actually happening. Change-Id: Ib3491984faaf9c15c6711a6c65b9c2eca28ddeb6
1 parent 9dda5ab commit aca67f5

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/WriteOperationHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public String toString() {
457457
@Retries.RetryTranslated
458458
public PutObjectResult putObject(PutObjectRequest putObjectRequest)
459459
throws IOException {
460-
return retry("put",
460+
return retry("Writing Object",
461461
putObjectRequest.getKey(), true,
462462
() -> owner.putObjectDirect(putObjectRequest));
463463
}
@@ -472,7 +472,7 @@ public PutObjectResult putObject(PutObjectRequest putObjectRequest)
472472
public UploadResult uploadObject(PutObjectRequest putObjectRequest)
473473
throws IOException {
474474
// no retry; rely on xfer manager logic
475-
return retry("put",
475+
return retry("Writing Object",
476476
putObjectRequest.getKey(), true,
477477
() -> owner.executePut(putObjectRequest, null));
478478
}

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/assumed_roles.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,25 @@ have access to the appropriate KMS keys.
4646
Trying to learn how IAM Assumed Roles work by debugging stack traces from
4747
the S3A client is "suboptimal".
4848

49-
### <a name="how_it_works"></a> How the S3A connector support IAM Assumed Roles.
49+
### <a name="how_it_works"></a> How the S3A connector supports IAM Assumed Roles.
5050

51-
To use assumed roles, the client must be configured to use the
51+
52+
The S3A connector support IAM Assumed Roles in two ways:
53+
54+
1. Using the full credentials on the client to request credentials for a specific
55+
role -credentials which are then used for all the store operations.
56+
This can be used to verify that a specific role has the access permissions
57+
you need, or to "su" into a role which has permissions that's the full
58+
accounts does not directly qualify for -such as access to a KMS key.
59+
2. Using the full credentials to request role credentials which are then
60+
propagated into a launched application as delegation tokens.
61+
This extends the previous use as it allows the jobs to be submitted to a
62+
shared cluster with the permissions of the requested role, rather than
63+
those of the VMs/Containers of the deployed cluster.
64+
65+
For Delegation Token integration, see (Delegation Tokens)[delegation_tokens.html]
66+
67+
To for Assumed Role authentication, the client must be configured to use the
5268
*Assumed Role Credential Provider*, `org.apache.hadoop.fs.s3a.auth.AssumedRoleCredentialProvider`,
5369
in the configuration option `fs.s3a.aws.credentials.provider`.
5470

@@ -298,7 +314,7 @@ Without these permissions, tables cannot be created, destroyed or have their IO
298314
changed through the `s3guard set-capacity` call.
299315
The `dynamodb:Scan` permission is needed for `s3guard prune`
300316

301-
The `dynamodb:CreateTable` permission is needed by a client it tries to
317+
The `dynamodb:CreateTable` permission is needed by a client when it tries to
302318
create the DynamoDB table on startup, that is
303319
`fs.s3a.s3guard.ddb.table.create` is `true` and the table does not already exist.
304320

@@ -758,14 +774,51 @@ Make sure that all the read and write permissions are allowed for any bucket/pat
758774
to which data is being written to, and read permissions for all
759775
buckets read from.
760776

777+
### <a name="access_denied_kms"></a> `AccessDeniedException` When working with KMS-encrypted data
778+
761779
If the bucket is using SSE-KMS to encrypt data:
762780

763781
1. The caller must have the `kms:Decrypt` permission to read the data.
764-
1. The caller needs `kms:Decrypt` and `kms:GenerateDataKey`.
782+
1. The caller needs `kms:Decrypt` and `kms:GenerateDataKey` to write data.
765783

766784
Without permissions, the request fails *and there is no explicit message indicating
767785
that this is an encryption-key issue*.
768786

787+
This problem is most obvious when you fail when writing data in a "Writing Object" operation.
788+
789+
If the client does have write access to the bucket, verify that the caller has
790+
`kms:GenerateDataKey` permissions for the encryption key in use.
791+
792+
```
793+
java.nio.file.AccessDeniedException: test/testDTFileSystemClient: Writing Object on test/testDTFileSystemClient:
794+
com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403;
795+
Error Code: AccessDenied; Request ID: E86544FF1D029857)
796+
797+
at org.apache.hadoop.fs.s3a.S3AUtils.translateException(S3AUtils.java:243)
798+
at org.apache.hadoop.fs.s3a.Invoker.once(Invoker.java:111)
799+
at org.apache.hadoop.fs.s3a.Invoker.lambda$retry$4(Invoker.java:314)
800+
at org.apache.hadoop.fs.s3a.Invoker.retryUntranslated(Invoker.java:406)
801+
at org.apache.hadoop.fs.s3a.Invoker.retry(Invoker.java:310)
802+
at org.apache.hadoop.fs.s3a.Invoker.retry(Invoker.java:285)
803+
at org.apache.hadoop.fs.s3a.WriteOperationHelper.retry(WriteOperationHelper.java:150)
804+
at org.apache.hadoop.fs.s3a.WriteOperationHelper.putObject(WriteOperationHelper.java:460)
805+
at org.apache.hadoop.fs.s3a.S3ABlockOutputStream.lambda$putObject$0(S3ABlockOutputStream.java:438)
806+
at org.apache.hadoop.util.SemaphoredDelegatingExecutor$CallableWithPermitRelease.call(SemaphoredDelegatingExecutor.java:219)
807+
at org.apache.hadoop.util.SemaphoredDelegatingExecutor$CallableWithPermitRelease.call(SemaphoredDelegatingExecutor.java:219)
808+
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
809+
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
810+
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
811+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
812+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
813+
at java.lang.Thread.run(Thread.java:748)
814+
Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403;
815+
Error Code: AccessDenied; Request ID: E86544FF1D029857)
816+
```
817+
818+
Note: the ability to read encrypted data in the store does not guarantee that the caller can encrypt new data.
819+
It is a separate permission.
820+
821+
769822
### <a name="dynamodb_exception"></a> `AccessDeniedException` + `AmazonDynamoDBException`
770823

771824
```

0 commit comments

Comments
 (0)