A developer has configured a microservice to perform actions in a different AWS account by assuming an IAM role. The microservice's execution role has an IAM policy that allows the sts:AssumeRole action on the target role's ARN. During execution, the microservice fails to assume the target role and receives an AccessDenied error. Which of the following is the most likely cause of this authorization failure?
- AThe permission policy attached to the target IAM role is missing the sts:AssumeRole action.
- BThe microservice is missing hardcoded AWS access keys for the target IAM role in its initialization code.
- The trust policy of the target IAM role does not list the microservice's execution role ARN as a trusted principal.Answer
- DThe destination account must configure an Amazon Cognito Identity Pool to authorize cross-account access for the microservice.
Answer
The trust policy of the target IAM role does not list the microservice's execution role ARN as a trusted principal.
For an identity to successfully assume an IAM role (especially in another account), two conditions must be met: the calling identity must have permission to call sts:AssumeRole on the target role, and the target role's trust policy must list the calling identity as a trusted principal. Since the caller already has the necessary permission policy, the failure is due to the trust policy of the target IAM role missing the caller's execution role ARN as a trusted principal.
Step-by-Step Solution
Key Concept
IAM AssumeRole Trust Policies