Your company has created a set of keys using the AWS KMS service.
They need to ensure that each key is only used for certain services.
For example, they want one key to be used only by the S3 service.
How can this be achieved?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer: C.
Option A is incorrect because mapping keys to services cannot be done via the IAM policy.
Option B is incorrect because mapping keys to services cannot be done via the bucket policy.
Option C is CORRECT because the km: ViaService condition key limits the use of a customer-managed CMK to requests from particular AWS services.
(AWS managed CMKs in your account, such as aws/s3, are always restricted to the AWS service that created them.)
Option D is incorrect because the requirement states each particular key should only be accessed by specific services and not specific IAM users.
For more information on KMS key policy, kindly refer to the following URL:
https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.htmlTo ensure that a particular key is only used for certain services, we can use the "kms:ViaService" condition in the key policy of the AWS KMS service. This condition allows us to specify the service that is authorized to use the key.
Option A, creating an IAM policy that allows the key to be accessed by only the S3 service, is incorrect because IAM policies are used to grant access to AWS resources and not to KMS keys.
Option B, creating a bucket policy that allows the key to be accessed by only the S3 service, is also incorrect because bucket policies are used to control access to S3 buckets and not to KMS keys.
Option D, defining an IAM user, allocating the key, and then assigning the permissions to the required service, is incorrect because IAM users are used to grant access to AWS resources and not to KMS keys.
Therefore, the correct answer is option C, which involves using the "kms:ViaService" condition in the key policy. The key policy can be updated to include this condition, specifying the service that is authorized to use the key. This will ensure that the key can only be used by the specified service, such as S3, and will prevent any unauthorized access to the key.