A SysOps administrator is configuring an AWS Systems Manager (SSM) Automation workflow in a multi-account organization. The administrator initiates execution from Account A (Operations, 111111111111) to remediate non-compliant EC2 instances in Account B (Production, 222222222222).
The workflow uses a custom automation execution role in Account B called SSMExecutionRole to perform remediation actions, which include attaching an IAM role named RemediationEC2Role to the target EC2 instances.
The administrator has configured the following:
1. The IAM role CentralOpsRole in Account A has permissions to assume SSMExecutionRole in Account B.
2. The trust policy of SSMExecutionRole in Account B allows CentralOpsRole to assume it.
3. The trust policy of RemediationEC2Role in Account B allows ec2.amazonaws.com to assume it.
The administrator initiates the automation execution from Account A using the assumed credentials of SSMExecutionRole. The execution fails at the step that associates RemediationEC2Role with the target EC2 instances with an AccessDenied error stating that the caller is not authorized to perform iam:PassRole.
Which configuration change is required to resolve this error using the principle of least privilege?
- Attach an IAM policy to the SSMExecutionRole in Account B that grants the iam:PassRole permission for the RemediationEC2Role ARN, specifying ec2.amazonaws.com in the iam:PassedToService condition key.Answer
- BAttach an IAM policy to the CentralOpsRole in Account A that grants the iam:PassRole permission for the SSMExecutionRole ARN, allowing it to be passed to ssm.amazonaws.com.
- CModify the trust policy of the RemediationEC2Role in Account B to allow the sts:AssumeRole action for the CentralOpsRole ARN from Account A.
- DAttach an IAM policy to the CentralOpsRole in Account A that grants the sts:AssumeRole permission for the RemediationEC2Role ARN in Account B.