A developer is setting up an AWS CodeBuild project for a microservice located in a subdirectory (`services/order-service`) of a monorepo. The build process needs to run tests that require a database password stored in AWS Secrets Manager, and it must use a custom build specification file located at `services/order-service/buildspec.yml`. During the initial build run, the build fails immediately because the build specification file cannot be found, and the developer realizes that the application also lacks permission to fetch the database password.
Which combination of actions must the developer take to resolve these issues? (Select two.)
- Configure the buildspec file path in the CodeBuild project settings to point to services/order-service/buildspec.yml.Answer
- Add the secretsmanager:GetSecretValue permission to the IAM service role associated with the CodeBuild project.Answer
- CMove the buildspec file to the root of the repository and rename it to buildspec-order.yml without updating the project settings.
- DUpdate the trust policy of the CodeBuild service role to allow the Secrets Manager service (secretsmanager.amazonaws.com) to assume the role.
- ERetrieve the database password in the buildspec env block using the parameter-store reference type.
Answer
Configure the buildspec file path in the CodeBuild project settings to point to services/order-service/buildspec.yml, and add the secretsmanager:GetSecretValue permission to the IAM service role associated with the CodeBuild project.
To fix the buildspec resolution issue, the developer must update the CodeBuild project settings to specify the custom path services/order-service/buildspec.yml, since CodeBuild expects buildspec.yml in the repository root by default. To resolve the permission issue, the developer must add the secretsmanager:GetSecretValue permission to the IAM service role associated with the CodeBuild project so that it is authorized to retrieve the database credentials.
Step-by-Step Solution
Key Concept
AWS CodeBuild buildspec configuration and IAM service role permissions.