A developer is configuring a blue/green deployment for an Amazon ECS service using AWS CodeDeploy. During the deployment process, the deployment fails with an access denied error because CodeDeploy is unable to modify the Application Load Balancer listeners and target groups. The developer verifies that the CodeDeploy service role has the AWSCodeDeployRoleForECS managed policy attached. Which configuration must the developer verify or update to resolve this deployment failure?
- The trust policy of the CodeDeploy service role, ensuring it allows the codedeploy.amazonaws.com service principal to assume the role.Answer
- BThe permission policy of the ECS Task Execution Role, ensuring it explicitly grants the sts:AssumeRole permission for the CodeDeploy service role.
- CThe IAM trust policy of the ECS Task Role, ensuring it lists the CodeDeploy service principal as a trusted entity.
- DThe configurations in AWS Systems Manager Parameter Store, ensuring the CodeDeploy service role ARN is stored as a SecureString parameter and referenced in the AppSpec file.
Answer
The trust policy of the CodeDeploy service role, ensuring it allows the codedeploy.amazonaws.com service principal to assume the role.
The trust policy of an IAM role defines which principal (such as an AWS service or another account) is allowed to assume the role. For AWS CodeDeploy to perform deployment actions on behalf of the developer (such as updating ECS target groups), its service role's trust policy must trust the CodeDeploy service principal (codedeploy.amazonaws.com) and allow the sts:AssumeRole action. If this trust policy is missing or misconfigured, CodeDeploy cannot assume the role, resulting in an access denied error even if the role has the correct permissions attached.
Step-by-Step Solution
Key Concept
AWS CodeDeploy Service Role Trust Policy
Estimated Time:1m 30s