AWS Developer DVA-C02 · Development with AWS Services · medium
Five different AWS Lambda functions written in Python 3.12 share the same 45 MB internal cryptography and data-validation library (corp_crypto_utils). Currently, every developer bundles a duplicate copy of the 45 MB library into each function's deployment .zip package, slowing down deployments and making library version updates tedious. Which AWS Lambda feature allows packaging shared libraries once and mounting them into /opt across multiple functions?
Published · Last updated · checked before publication — how we verify questions
Options
Answer: B. AWS Lambda Layers mounted into the /opt directory of each function
Lambda Layers are the feature built for this scenario. A layer is a versioned .zip archive that holds libraries, a custom runtime, or configuration files. You publish it once, and any number of functions can reference its ARN. At cold start Lambda extracts the layer contents into the /opt directory of the execution environment. For Python, packages placed under a python/ folder in the layer are added to the import path, so the functions can import corp_crypto_utils with no code changes. Each function can use up to five layers, and the unzipped size of the function code plus all its layers must stay within 250 MB. Because layer versions are immutable, you update the library by publishing a new version and pointing each function at it. The common trap is to think of /tmp as shared storage. It is not, and it is the wrong place to deliver code dependencies.
Why the other options are wrong
- A. Lambda Ephemeral Storage (/tmp) shared across functions — Ephemeral storage at /tmp is scratch space attached to a single execution environment. It is not shared between functions, and it does not persist or distribute packaged code. It cannot hold a shared library for five separate functions.
- C. Amazon API Gateway Mapping Templates written in Apache Velocity (VTL) — API Gateway mapping templates use Apache Velocity Template Language (VTL) to transform request and response payloads at the API layer. They have nothing to do with packaging or distributing Python dependencies to Lambda runtimes.
- D. AWS Step Functions Express Workflow state payloads (256 KB maximum) — Step Functions Express Workflows orchestrate state machines, and their state payloads are limited to 256 KB. They do not mount code into Lambda functions, and a 45 MB library could not fit in a payload anyway.
More Development with AWS Services questions
- An Amazon API Gateway REST API fronts a legacy product-catalog backend that takes 800 ms per query. Because 90% of…
- A customer-facing checkout API built on AWS Lambda (Java 21 runtime) experiences a 3.2-second cold-start latency spike…
- An AWS Lambda function polls an Amazon SQS standard queue via an Event Source Mapping with a batch size of 10…
- An order-fulfillment workflow coordinates 6 sequential and parallel steps: reserve inventory, charge credit card…
- A photo-sharing platform stores private user photos in an Amazon S3 bucket (Block Public Access = ON). When an…
- A web application hosted on https://app.example.com makes an XMLHttpRequest / fetch() POST call (with a custom…
- A financial ledger uses Amazon SQS FIFO (First-In-First-Out) queues (orders.fifo) to guarantee strict message ordering…
- A developer is designing indexes for an Amazon DynamoDB Orders table whose base primary key is CustomerId (Partition…
All Development with AWS Services questions and the topic overview →
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.