AWS Certified Developer Associate · Free Practice Question Medium

Question 59

A developer is building a new application on AWS. The application uses an AWS Lambda function that retrieves information from an Amazon DynamoDB table. The developer hard coded the DynamoDB table name into the Lambda function code. The table name might change over time. The developer does not want to modify the Lambda code if the table name changes. Which solution will meet these requirements MOST efficiently?
  • A Store the table name in a file. Store the file in the /tmp folder. Use the SDK for the programming language to retrieve the table name.
  • B Create a file to store the table name. Zip the file and upload the file to the Lambda layer. Use the SDK for the programming language to retrieve the table name.
  • C Create a global variable that is outside the handler in the Lambda function to store the table name.
  • D Create a Lambda environment variable to store the table name. Use the standard method for the programming language to retrieve the variable.
Reveal correct answer

Correct answer: B

Explanation

The most efficient solution for the developer to avoid modifying the AWS Lambda code when the DynamoDB table name changes is to create a Lambda environment variable to store the table name. The developer can then use the standard method for the programming language to retrieve this variable within the Lambda function. This approach allows for easy updates to the table name without altering the Lambda function code.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need