An organization requires a build environment in AWS CodeBuild to execute integration tests against an internal Amazon RDS DB instance situated in a private subnet. The build container must fetch external software packages from the public internet and retrieve a database password from AWS Secrets Manager. Currently, the build execution fails because it cannot access external repositories, and an authorization error occurs when fetching the credential from AWS Secrets Manager.
Which combination of steps should be taken to resolve these network and access issues? (Select TWO.)
- Configure the CodeBuild project to run within private subnets that have a route to a NAT gateway in a public subnet to allow internet connectivity.Cevap
- Ensure that the CodeBuild IAM service role is granted secretsmanager:GetSecretValue permissions and that its trust policy allows the service principal codebuild.amazonaws.com to assume the role.Cevap
- CUpdate the CodeBuild IAM service role's trust policy to allow secretsmanager.amazonaws.com to assume the role, allowing AWS Secrets Manager to push the credential into the build environment.
- DMigrate the database password to AWS Systems Manager Parameter Store as a Standard parameter, configure automatic rotation, and retrieve it using the parameter-store block in the buildspec.
- EPlace the buildspec.yml file containing the secret configuration in a sub-folder named config/ within the repository without changing the default CodeBuild project buildspec settings.
Cevap
To resolve the issues, configure the CodeBuild project to run within private subnets that have a route to a NAT gateway in a public subnet, and ensure that the CodeBuild IAM service role is granted secretsmanager:GetSecretValue permissions with a trust policy allowing codebuild.amazonaws.com to assume the role.
The correct configuration requires routing outbound traffic from CodeBuild's private VPC subnets to a NAT gateway so that the build container can reach the public internet to download external dependencies. Additionally, the CodeBuild IAM service role must have secretsmanager:GetSecretValue permission and a trust policy that allows codebuild.amazonaws.com to assume the role, enabling CodeBuild to authenticate and retrieve the database password.
Adım Adım Çözüm
Anahtar Kavram
AWS CodeBuild VPC networking and service role configuration
Tahmini Süre:2m 30s