A developer is configuring a new AWS CodeBuild project to build and package a serverless application. When attempting to start a build, the execution fails immediately with the error message: "Failed to assume the service role." The developer confirms that the associated IAM service role has the correct managed policies for accessing Amazon S3, Amazon CloudWatch Logs, and VPC resources. What should the developer modify to resolve this issue and allow the build to initiate?
- The trust relationship of the IAM service role, ensuring that the codebuild.amazonaws.com service principal is allowed to perform the sts:AssumeRole action.Answer
- BThe identity-based permissions policy of the IAM service role, adding a statement that grants the sts:AssumeRole action to the codebuild.amazonaws.com principal.
- CThe location of the buildspec.yml file, moving it to a configuration subdirectory and updating the buildspec path in the CodeBuild project configuration.
- DThe build project's environment variables, dynamically fetching the temporary session credentials of the IAM service role from AWS Systems Manager Parameter Store during the install phase.
Answer
The trust relationship of the IAM service role, ensuring that the codebuild.amazonaws.com service principal is allowed to perform the sts:AssumeRole action.
The correct option is the one specifying the trust relationship of the IAM service role. For AWS CodeBuild to execute a build, it must assume the specified IAM service role. This trust relationship must be defined in the role's trust policy, permitting the 'codebuild.amazonaws.com' service principal to call 'sts:AssumeRole'.
Step-by-Step Solution
Key Concept
AWS CodeBuild Service Role Trust Policy