Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Question 5 of 94
Free Preview · 94 of 312 · questions 1–94 of 312 are free. Sign up free to sync your progress across devices.
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
Lambda layers are designed exactly for this use-case — sharing common libraries or custom code across multiple Lambda functions. When you update the layer version, all Lambda functions using that layer can start using the new version with minimal changes, avoiding manual updates to each function's code base. Why the others are incorrect A & C: Storing pointers in S3 (either in context or environment variables) doesn’t solve the problem. Lambda cannot “pull” Python scripts from S3 at runtime and treat them as importable modules without custom logic. D: Aliases are for versioning and traffic shifting. They do not distribute or update shared code across multiple Lambda functions.
Centralized Code Management: Lambda layers allow you to store and manage the custom Python scripts in a central location outside the individual Lambda function code. This eliminates the need to update the script in each Lambda function manually. Reusable Code: Layers provide a way to share code across multiple Lambda functions. Any changes made to the layer code are automatically reflected in all the functions using that layer, streamlining updates. Reduced Deployment Size: By separating core functionality into layers, you can keep the individual Lambda function code focused and smaller. This reduces deployment package size and potentially improves Lambda execution times.
B. Package the custom Python scripts into Lambda layers. Apply the Lambda layers to the Lambda functions. Explanation: Lambda layers allow you to centrally manage shared code and dependencies across multiple Lambda functions. By packaging the custom Python scripts into a Lambda layer, you can simply update the layer whenever changes are made to the scripts, and all the Lambda functions that use the layer will automatically inherit the updates. This approach reduces manual effort and ensures consistency across the functions.