
Answer-first summary for fast verification
Answer: Correct the policy of the IAM user to allow the kms:GenerateDataKey action
Correct the policy of the IAM user to allow the kms:GenerateDataKey action - You can protect data at rest in Amazon S3 by using three different modes of server-side encryption: SSE-S3, SSE-C, or SSE-KMS. SSE-KMS requires that AWS manage the data key but you manage the customer master key (CMK) in AWS KMS. You can choose a customer managed CMK or the AWS managed CMK for Amazon S3 in your account. If you choose to encrypt your data using the standard features, AWS KMS and Amazon S3 perform the following actions: Amazon S3 requests a plaintext data key and a copy of the key encrypted under the specified CMK. AWS KMS generates a data key, encrypts it under the CMK, and sends both the plaintext data key and the encrypted data key to Amazon S3. Amazon S3 encrypts the data using the data key and removes the plaintext key from memory as soon as possible after use. Amazon S3 stores the encrypted data key as metadata with the encrypted data. The error message indicates that your IAM user or role needs permission for the kms:GenerateDataKey action. This permission is required for buckets that use default encryption with a custom AWS KMS key. In the JSON policy documents, look for policies related to AWS KMS access. Review statements with "Effect": "Allow" to check if the user or role has permissions for the kms:GenerateDataKey action on the bucket's AWS KMS key. If this permission is missing, then add the permission to the appropriate policy. In the JSON policy documents, look for statements with "Effect": "Deny". Then, confirm that those statements don't deny the s3:PutObject action on the bucket. The statements must also not deny the IAM user or role access to the kms:GenerateDataKey action on the key used to encrypt the bucket. Additionally, make sure the necessary KMS and S3 permissions are not restricted using a VPC endpoint policy, service control policy, permissions boundary, or session policy. Incorrect options: Correct the policy of the IAM user to allow the s3:Encrypt action - This is an invalid action given only as a distractor. Correct the bucket policy of the S3 bucket to allow the IAM user to upload encrypted objects - The user already has access to the bucket. What the user lacks is access to generate a KMS key, which is mandatory when a bucket is enabled for default encryption. Correct the ACL of the S3 bucket to allow the IAM user to upload encrypted objects - Amazon S3 access control lists (ACLs) enable you to manage access to buckets and objects. Each bucket and object has an ACL attached to it as a subresource. It defines which AWS accounts or groups are granted access and the type of access. ACL is another way of giving access to S3 bucket objects. Permissions to use KMS keys will still be needed.
Ultimate access to all questions.
No comments yet.
Author: LeetQuiz Editorial Team
A development team has set up a new IAM user and granted it the s3:putObject permission, allowing it to write objects to an S3 bucket. This particular S3 bucket employs server-side encryption using AWS KMS managed keys (SSE-KMS) as its default encryption method. However, when the application attempts to use the access key ID and secret access key of the IAM user to call the PutObject API, it encounters an access denied error.
As a Developer Associate, what steps would you take to resolve this issue?
A
Correct the bucket policy of the S3 bucket to allow the IAM user to upload encrypted objects
B
Correct the policy of the IAM user to allow the s3:Encrypt action
C
Correct the policy of the IAM user to allow the kms:GenerateDataKey action
D
Correct the ACL of the S3 bucket to allow the IAM user to upload encrypted objects