A SysOps Administrator is using AWS Systems Manager Run Command to execute a maintenance script on a fleet of Amazon EC2 instances. All target instances have the SSM Agent installed and running, and they are associated with an IAM instance profile containing the AmazonSSMManagedInstanceCore policy. The administrator configures the Run Command to output execution logs to an Amazon S3 bucket that is encrypted using an AWS KMS customer managed key. The command runs successfully on the instances, but the execution logs fail to appear in the S3 bucket. Which of the following is the most likely cause of this issue?
- AThe S3 bucket policy does not grant the Systems Manager service principal (ssm.amazonaws.com) permissions to write objects to the bucket.
- BThe IAM policy attached to the administrator's user lacks the iam:PassRole permission for the customer managed KMS key.
- The IAM instance profile role associated with the EC2 instances lacks permission to perform the kms:GenerateDataKey action on the KMS key.Answer
- DThe target instances do not have the proper patch group tags aligned with the Systems Manager Patch Baseline to authorize log delivery.
Answer
The IAM instance profile role associated with the EC2 instances lacks permission to perform the kms:GenerateDataKey action on the KMS key.
When configuring AWS Systems Manager Run Command to send output logs to an Amazon S3 bucket encrypted with SSE-KMS using a customer managed key, the SSM Agent running on the EC2 instance writes the logs directly. Therefore, the IAM instance profile role attached to the EC2 instances must have permission to perform the kms:GenerateDataKey action on the KMS key to encrypt the log objects during upload.
Step-by-Step Solution
Key Concept
Systems Manager Run Command S3 log export permissions and KMS encryption
Estimated Time:1m 30s