A developer is troubleshooting a cross-account deployment failure. A CI/CD pipeline using AWS CodePipeline in Account A () needs to deploy resources into Account B () by assuming a role named `CrossAccountDeployRole` in Account B.
The pipeline fails at the deploy stage with the error:
`CodePipeline is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::222222222222:role/CrossAccountDeployRole`
In Account B, the developer has configured the following trust policy for `CrossAccountDeployRole`:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "codepipeline.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Which two actions should the developer take to resolve this authorization failure?
- Attach an IAM policy to the CodePipeline service role in Account A that allows the `sts:AssumeRole` action on `arn:aws:iam::222222222222:role/CrossAccountDeployRole`.Answer
- Update the trust policy of `CrossAccountDeployRole` in Account B to replace the `codepipeline.amazonaws.com` service principal with the ARN of the CodePipeline service role in Account A.Answer
- CAttach an identity-based permission policy to `CrossAccountDeployRole` in Account B that allows the `sts:AssumeRole` action on the CodePipeline service role in Account A.
- DStore a set of long-term IAM user access keys from Account B inside the CodePipeline configuration and pass them as environment variables.
- EConfigure an Amazon Cognito Identity Pool in Account B to authenticate the CodePipeline service principal and issue temporary credentials.