CV0-004 Deployment Practice Question
A developer is deploying a serverless application using AWS Lambda. They want to reuse common code (e.g., database connection logic) across multiple functions without duplicating it. Which Lambda feature should they use?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Lambda layers
Lambda Layers allow you to package and share code across multiple functions, enabling code reuse and reducing deployment package size.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Lambda versions
Why it's wrong here
Versions are immutable snapshots of a function's code and configuration, so they cannot hold shared libraries referenced by other functions. They are tempting because they support safe deployment rollback and traffic shifting, which is the correct use case when you need to publish and test a stable release.
- ✗
Lambda aliases
Why it's wrong here
Aliases are named pointers to versions, used for traffic routing and staged deployments; they hold no code, so shared database logic cannot live in them. They are tempting because they let you promote a version between environments, which is correct when you need blue/green or canary releases.
- ✓
Lambda layers
Why this is correct
Lambda layers package shared libraries and dependencies separately from function code, so database connection logic is referenced by multiple functions rather than duplicated in each deployment package. This directly satisfies the requirement to reuse common code across functions while keeping individual deployment artefacts small.
- ✗
Lambda environment variables
Why it's wrong here
Environment variables store configuration values such as connection strings at runtime, not reusable code modules. They are tempting because they do externalise settings from function code, which is the right choice when the same function must point at different databases per environment.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
One of 834 original CV0-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CV0-004 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CV0-004 exam.