AWS Certified Developer - Associate (DVA-C03) Practice Questions

AWS Certified Developer - Associate (DVA-C03) exam preparation

AWS Certified Developer - Associate (DVA-C03) practice questions in English: 180 questions with explanations. The mock exam has 65 questions and 130 minutes.

AWS Certified Developer - Associate (DVA-C03) free question 7 / 10 · Domain 3: Testing and Deployment

A REST API in Amazon API Gateway has a dev stage and a prod stage. Both stages call the same Lambda function, which must read a different Amazon DynamoDB table in each stage. The team does not want a second copy of the API or of the function. What should the team do?

  1. Put the table name and the access keys of the tables into stage variables to let the function sign its own requests
  2. Create a separate REST API per environment and write the name of the table into the integration request of that API
  3. Define a stage variable with the table name per stage and pass it in the mapping template of the integration request
  4. Use a stage variable to give the dev stage an HTTP proxy integration and the prod stage the Lambda proxy integration
Show the answer and explanation

Answer: C

Why this is correct
Stage variables are key-value pairs that are attached to a deployment stage of a REST API and act like environment variables. The page gives this exact case: the same Lambda function is reused for multiple stages, and the function reads data from a different DynamoDB table depending on the stage. The mapping template that generates the request for the function uses the stage variable, for example by referencing ${stageVariables.name}, and passes the table name to Lambda. Each stage defines its own value, so one API and one function serve both stages, and no credentials are stored in the variables.

Why the other options are wrong
"Create a separate REST API per environment and write the name of the table into the integration request of that API" … Stage variables exist so that one API can manage multiple release stages and still reach different backends. A copy of the API per environment is the duplication the team wants to avoid.
"Use a stage variable to give the dev stage an HTTP proxy integration and the prod stage the Lambda proxy integration" … A stage variable cannot set a different integration endpoint of that kind, such as an HTTP proxy in one stage and a Lambda proxy in another. The stages must reach the same function.
"Put the table name and the access keys of the tables into stage variables to let the function sign its own requests" … Stage variables are not intended for sensitive data such as credentials. The table name is a harmless value, but the access keys do not belong in a stage variable.

Key points
Stage variables: per-stage values (backend host, function name, table name) used in integration settings and mapping templates; not for credentials.

Go to the AWS Certified Developer - Associate (DVA-C03) practice app (10 free questions; purchase unlocks all questions)

See the full practice set