A company implements automated compliance monitoring. An AWS Config rule named restricted-ssh is configured to evaluate security groups. When a security group is flagged as non-compliant, an Amazon EventBridge rule detects the compliance change and targets a Systems Manager Automation runbook named AWS-CloseSecurityGroup to close port 22.
The configuration details are as follows:
- The EventBridge rule uses an Input Transformer to map the non-compliant security group ID to the runbook's GroupId parameter.
- A dedicated IAM role named RemediationExecutionRole exists with a trust policy for ssm.amazonaws.com and permissions to modify EC2 security groups.
- The EventBridge rule is configured with an IAM service role named EventBridgeTargetRole that trusts events.amazonaws.com and has permissions to execute ssm:StartAutomationExecution on the runbook.
When the EventBridge rule is triggered, the Systems Manager Automation execution fails to start. Which of the following is the correct configuration change to resolve this issue?
- Add the iam:PassRole permission for the RemediationExecutionRole to the EventBridgeTargetRole policy, and specify the RemediationExecutionRole ARN as the AutomationAssumeRole parameter in the EventBridge target input template.Cevap
- BModify the trust policy of the RemediationExecutionRole to trust events.amazonaws.com, and add the iam:PassRole permission for the EventBridgeTargetRole to the RemediationExecutionRole policy.
- CAdd the iam:PassRole permission for the EventBridgeTargetRole to the policy attached to the RemediationExecutionRole, and modify the trust policy of the EventBridgeTargetRole to trust ssm.amazonaws.com.
- DChange the EventBridge rule target from Systems Manager Automation to Systems Manager Run Command, and associate the RemediationExecutionRole with the EC2 instances directly.