Skip to main content

DVA-C02 practice question · Development with AWS Services

A Lambda function needs to share a common logging library and a set of utility functions across multiple functions…

A Lambda function needs to share a common logging library and a set of utility functions across multiple functions without bundling them into each deployment package. What is the best way to do this?

  • APackage the shared code as a Lambda layer and attach it to each function
  • BCopy and paste the shared code into every function's deployment package
  • CStore the shared code as an object in Amazon S3 and download it at the start of every invocation
  • DStore the shared code in a DynamoDB item
Show the answer and explanation

Correct answer: A) Package the shared code as a Lambda layer and attach it to each function

Why each option is right or wrong

  • A) Correct. Layers let you package shared libraries and dependencies separately from function code, keeping deployment packages small and letting multiple functions reuse the same layer version.
  • B) Incorrect. Duplicating code across functions makes updates error-prone and bloats every deployment package, exactly what layers avoid.
  • C) Incorrect. Downloading shared code on every cold invocation adds unnecessary latency and complexity compared to a layer, which is already available in the execution environment.
  • D) Incorrect. DynamoDB stores data, not executable code artifacts; it isn't designed to distribute shared libraries to Lambda functions.
Exam domain
Development with AWS Services · 32% of DVA-C02
Question type
Multiple choice (one answer)

Practise the full DVA-C02 exam

This question is one of a small free sample from the CertRidge DVA-C02 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.

Original question written from the official exam guide. Not affiliated with AWS; never copied from the real exam.

Worth reading: DVA-C02 cheat sheet, Lambda, DynamoDB, API Gateway, IAM and Cognito, messaging, CI/CD and X-Ray in tables, plus what DVA-C03 changes.