A developer is configuring a multi-account CI/CD pipeline using AWS CodePipeline. The pipeline executes an AWS CodeBuild project in Account A. As part of the build spec, the project runs a deployment script that is designed to deploy an AWS CloudFormation stack in Account B. During execution, the build fails at the deployment step with the error: `An error occurred (AccessDenied) when calling the AssumeRole operation`. Which two actions should the developer take to resolve this failure? (Select TWO.)
- In Account A, attach a policy to the CodeBuild service role that grants the `sts:AssumeRole` permission on the target role's Amazon Resource Name (ARN) in Account B.Answer
- In Account B, update the trust policy of the target IAM role to allow the ARN of the CodeBuild service role from Account A to assume it.Answer
- CIn Account B, update the permissions policy of the target IAM role to grant the `sts:AssumeRole` permission to the AWS CodeBuild service principal.
- DIn Account A, update the trust policy of the CodeBuild service role to trust the target IAM role in Account B.
- EIn Account B, run the `aws cloudformation delete-stack` command to delete the target stack before initiating the pipeline again.
Answer
In Account A, attach a policy to the CodeBuild service role that grants the `sts:AssumeRole` permission on the target role's ARN in Account B; and in Account B, update the trust policy of the target IAM role to allow the ARN of the CodeBuild service role from Account A to assume it.
The correct options state that a policy must be attached to the CodeBuild service role in Account A granting `sts:AssumeRole` on the target role's ARN, and the target role's trust policy in Account B must be updated to trust the CodeBuild service role from Account A. This pair of configurations satisfies the cross-account delegation requirements in AWS IAM.
Step-by-Step Solution
Key Concept
Cross-account IAM role assumption requires granting `sts:AssumeRole` permission in the source account and trusting the source principal in the target role's trust policy.
Estimated Time:2m 0s