S3 Bucket Keys & IAM Policy Integration

0

We are looking to implement S3 bucket keys but I can't find any documentation when it comes to modification of an IAM policy. I've gone through AWS documentation here: https://aws.amazon.com/blogs/storage/reduce-encryption-costs-by-using-amazon-s3-bucket-keys-on-existing-objects/ https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html#encryption-context https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html#bucket-key-changes https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html#encryption-context

The documentation states that we would need to possibly update IAM policies to allow for the S3 bucket key but I can't seem to find anything specific as to how to go about that. For this purpose, we also don't want to give a permissions of creating buckets for this policy.

2 Answers
0
Accepted Answer

Hello,

Please note that if you plan to enable S3 Bucket Keys, then before that you need to update your AWS Identity and Access Management (IAM) policies or AWS KMS key policies. If your existing AWS Identity and Access Management (IAM) policies or AWS KMS key policies use your object Amazon Resource Name (ARN) as the encryption context to refine or limit access to your KMS key, these policies won't work with an S3 Bucket Key. S3 Bucket Keys use the bucket ARN as encryption context. Before you enable an S3 Bucket Key, update your IAM policies or AWS KMS key policies to use your bucket ARN as the encryption context.

If you use SSE-KMS and enable an S3 Bucket Key, the bucket ARN is used as the encryption context.

arn:aws:s3:::bucket_ARN

As an example, when S3 Bucket Keys are enabled then the encryption context in the IAM Policy statement should look as follows :

{ "Action":[ "kms:*" >> You can restrict the KMS actions as per your use case. ], "Effect":"Allow", "Condition":{ "StringLike":{ "kms:ViaService":"s3.bucket-region.amazonaws.com", "kms:EncryptionContext:aws:s3:arn":[ "arn:aws:s3:::DOC-EXAMPLE-BUCKET" ] } }, "Resource":[ "List of the AWS KMS key ARNs that are used to encrypt objects." ] }

As you can see in the above statement, Encryption Context is specified on bucket ARN and not Object ARN. You need to make similar changes in your IAM Policy. One of the example policies are mentioned in S3 replication use cases where the IAM policy grants the necessary permissions to replicate objects with S3 Bucket Keys. Please refer the 'Example – Replicating objects with S3 Bucket Keys' section in the following link. : https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-config-for-kms-objects.html#replications

Further, please note that the changes are made for Encryption Context and KMS actions are considered for this use case. No S3 actions need to be updated and hence these would restrict the users/roles from creating the buckets which was one of your concerns.

AWS
SUPPORT ENGINEER
answered 7 months ago
0

Thank you for your question.

Please take a look at this article which covers multiple situations where Users are trying to interact with buckets encrypted with kms keys.

It covers both the IAM policy and the AWS KMS policy configurations.

Hope that helps.

AWS
David C
answered 7 months ago
  • Thank you but this relayed to an event that has already passed.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions