An organization is setting up a continuous integration pipeline. The build phase is executed by AWS CodeBuild using a custom IAM service role. However, during the initial run, the build fails immediately before executing any build phases, throwing an error that CodeBuild is not authorized to assume the specified service role. Which of the following actions will resolve this issue?
- Modify the trust policy of the IAM service role to allow the codebuild.amazonaws.com service principal to assume the role.Cevap
- BAttach a permission policy to the IAM service role that grants the sts:AssumeRole permission to the developer's IAM user.
- CMove the buildspec.yml file from the root directory to a newly created configuration subdirectory in the source repository.
- DModify the build project settings to retrieve credentials using AWS Secrets Manager rather than Systems Manager Parameter Store.
Cevap
Modify the trust policy of the IAM service role to allow the codebuild.amazonaws.com service principal to assume the role.
The correct answer is to modify the trust policy of the IAM service role. AWS CodeBuild requires a service role to perform actions on your behalf. For CodeBuild to assume this role, the role's trust policy must explicitly allow the 'codebuild.amazonaws.com' service principal to perform the 'sts:AssumeRole' action. Without this trust relationship, CodeBuild cannot run the build project and fails immediately during initialization.
Adım Adım Çözüm
Anahtar Kavram
AWS CodeBuild service role trust policy configuration