AWS Developer DVA-C02 · Deployment · medium
A developer is writing a buildspec.yml file for AWS CodeBuild that compiles a Node.js TypeScript service, runs unit tests, and packages a production artifact. During the build, the script needs to fetch a database test password from AWS Secrets Manager (arn:aws:secretsmanager:us-east-1:111122223333:secret:TestDB-AbCdEf) and expose it as an environment variable inside the build container without hardcoding the secret in buildspec.yml. Which native buildspec.yml section supports this?
Published · Last updated · checked before publication — how we verify questions
Options
Answer: C. Declare the secret under the env: secrets-manager: block in buildspec.yml
In CodeBuild buildspec.yml (version 0.2), the env.secrets-manager (and env.parameter-store) mapping block natively resolves secrets from AWS Secrets Manager (or SSM Parameter Store) using the CodeBuild service role and injects them as masked environment variables during the build.
Why the other options are wrong
- A. Commit the plaintext password inside the phases.install.commands list in Git — Committing plaintext secrets into buildspec.yml in Git exposes credentials to anyone with repo access.
- B. Place the secret ARN inside the artifacts.discard-paths boolean field — discard-paths strips directory hierarchies from output artifacts; it does not resolve Secrets Manager values.
- D. Declare the secret inside an EC2 appspec.yml ValidateService lifecycle hook — appspec.yml is for AWS CodeDeploy runtime deployment, not AWS CodeBuild compilation.
More Deployment questions
- An AWS CloudFormation stack provisions an Amazon RDS production database and an Amazon S3 audit bucket. If a junior…
- A serverless team uses AWS SAM (template.yaml) and AWS CodeDeploy to deploy a new version of an AWS Lambda function…
- An application runs on AWS Elastic Beanstalk across a fleet of 6 EC2 instances behind an Application Load Balancer…
- In an AWS CloudFormation template, Stack A (NetworkStack) creates a production VPC and wants to export the VpcId so…
AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.