DVA-C02 Deployment Practice Question
A developer is deploying a serverless application that includes an AWS Lambda function with a dependency on a native library (e.g., a compiled C library). The developer uses AWS SAM. The Lambda function runs correctly in the local development environment but fails with an 'Unable to import module' error when deployed. What is the most likely cause?
⚠ Common exam trap
Many exam-takers confuse IAM permissions with filesystem access, or assume the error is a code-level issue (handler or timeout) rather than recognizing the OS-level binary incompatibility unique to Lambda's Amazon Linux environment.
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
✓
The native library is compiled for a different operating system than Lambda (Amazon Linux).
AWS Lambda runs on Amazon Linux, which uses a different kernel and C runtime than typical local development environments (e.g., macOS or Windows). Native libraries compiled for a local OS will not be compatible with Lambda's execution environment, causing the 'Unable to import module' error. The developer must compile the native library on Amazon Linux or use a Lambda-compatible container to ensure binary compatibility.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The Lambda function's IAM role does not have permission to access the library.
Why it's wrong here
The Lambda function's IAM role governs its permissions to interact with other AWS services, such as S3, DynamoDB, or CloudWatch Logs. It does not control access to files or libraries included within the function's deployment package itself. An ImportError typically indicates that the runtime cannot locate or load a module from the local file system, not a lack of authorization to an external AWS resource.
- ✗
The Lambda function's handler configuration is incorrect.
Why it's wrong here
The handler configuration specifies the entry point for your Lambda function, directing the runtime to a specific file and function within your code. If the application functions correctly when run locally, it strongly suggests that the handler path is correctly defined and points to a valid function. An ImportError, conversely, signifies a problem with loading a dependency or module *before* the handler function is even invoked, rather than an issue with the handler's location or name.
- ✓
The native library is compiled for a different operating system than Lambda (Amazon Linux).
Why this is correct
AWS Lambda execution environments are based on Amazon Linux, requiring any native libraries (e.g., C/C++ compiled into .so files) to be compiled specifically for this operating system and its architecture (x86_64 or arm64). If a library is compiled on a different OS, such as macOS or Windows, or even a different Linux distribution, its binary format and system dependencies will be incompatible. This incompatibility leads to an ImportError when the Lambda runtime attempts to load the shared object, as it cannot resolve the necessary symbols or link against the correct system libraries.
- ✗
The Lambda function's timeout is too short.
Why it's wrong here
The Lambda function's timeout setting dictates the maximum duration a function is allowed to execute before AWS forcibly terminates it. If a function exceeds this limit, a specific 'Task timed out' error is generated. An ImportError, however, occurs much earlier in the function's lifecycle, typically during the initialization phase when the runtime attempts to load all required modules and dependencies. It signifies a failure to find or properly load a library, not that the function ran for an excessive period.
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 724 original DVA-C02 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 DVA-C02 practice question is part of Courseiva's free Amazon Web Services 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 DVA-C02 exam.