Course menuDVA-C03

Exams / DVA-C03 / Study guide / Lambda configuration

Lambda configuration: DVA-C03 study notes and practice questions

What to know about Lambda configuration for the DVA-C03 exam, from the Development with AWS Services domain (30% of the exam guide), then 1 free question to test it. Part of the DVA-C03 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

Lambda configuration is covered in Domain 1 under configuring functions with environment variables, memory, concurrency, timeout, runtime, handler, layers and extensions. Questions give a symptom or a limit and ask which setting fixes it.

Settings and what they control

  • Memory sets the amount of memory, and CPU power scales with it. More memory can shorten a CPU-bound run, which also affects cost.
  • Timeout is the maximum time per invocation. A standard function can run for up to 15 minutes. Longer work belongs in Step Functions, with each invocation handling a chunk.
  • Ephemeral storage sets the size of /tmp. It is separate from memory and can be raised up to 10,240 MB.
  • Environment variables are limited to 4 KB in total. Store larger configuration in AWS AppConfig or Parameter Store and read it at start-up or when needed.
  • Handler names the file and function, for Python in the form file.function, such as app.handle_order.
  • Architecture can be x86_64 or arm64. Switching to arm64 can lower cost when the dependencies support it.

Packages and layers

  • A .zip upload can be up to 50 MB zipped when uploaded directly. Larger packages go to S3 and are referenced from there.
  • The unzipped deployment package, including all layers, is limited to 250 MB.
  • Layers hold shared libraries or data. Lambda extracts them into /opt. Python layers must place packages under a python/ directory so they land at /opt/python.
  • A large model or data file belongs in S3, loaded at start-up, not in the package.

Concurrency

  • Reserved concurrency caps a function’s concurrent executions and reserves that capacity for it. Setting it to 0 stops the function from running, which can pause processing without deleting its triggers.
  • Provisioned concurrency keeps environments initialized for predictable latency, at extra cost.

How to choose

Symptom in the question Setting
Function times out while calling a slow partner Raise the timeout above the normal response time
Function needs a large temporary working area Ephemeral storage
Rule document is too big for environment variables AppConfig or Parameter Store
Same library in many functions One layer shared by all of them
Import error after adding a layer Check the python/ folder structure in the archive
Package over the upload limit S3 upload, then update the function from the S3 location

Common traps

  • Raising memory to fix a timeout caused by a fixed wait on a partner. Memory does not change how long a network call takes.
  • Putting secrets or large config in environment variables when the 4 KB limit applies.
  • Packaging everything instead of using layers or S3 for large assets.
  • Forgetting that layers count toward the 250 MB unzipped limit.
  • Confusing reserved and provisioned concurrency. Reserved caps and guarantees capacity; provisioned keeps environments warm.
  • Using a 0-concurrency setting and expecting the trigger to be removed.

Try the 1 practice question

A Lambda function unzips customer archives from Amazon S3 into /tmp and then processes the files.

Each archive is about 2 GB and unpacks to around 7 GB. Runs fail with "No space left on device" while the archive is being unpacked. Memory use and run time are well within their limits, and the team wants the smallest change that fixes the problem.

What should the developer change?

Choose one answer.

  1. A. Increase the function's ephemeral storage setting to 10,240 MB, the maximum allowed.
  2. B. Increase the function's memory to 10,240 MB, which also gives it more disk space in /tmp.
  3. C. Add a Lambda layer that contains a larger directory for the archives to unpack into.
  4. D. Package the function as a container image, which provides a larger writable disk for /tmp.
Show the answer and explanation

Answer: A

  • A. Right: Correct. Ephemeral storage sets the size of the writable /tmp directory. It can be set from 512 MB up to 10,240 MB, which leaves room for the unpacked files. Learn more: Configuring ephemeral storage for Lambda functions (opens in a new tab)
  • B. Wrong: Memory and ephemeral storage are separate settings. More memory gives more CPU and RAM, but the size of /tmp does not change.
  • C. Wrong: Layers add read-only content to the function. They do not add writable space, so the archives still have nowhere to unpack.
  • D. Wrong: The image holds code and dependencies. Writable space in /tmp is still set by the ephemeral storage setting, not by the image.

Explanation

Each Lambda execution environment has a writable /tmp directory whose size is set by the ephemeral storage setting. That setting is separate from memory and can be raised up to 10,240 MB, which gives room for the unpacked files.

Study

Want more on Lambda configuration? The 5 full-length practice sets have 9 more Lambda configuration questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study Lambda configuration

More Development with AWS Services topics