Question 1,537 of 724
DVA-C02 Security Practice Question
A Lambda function needs to write logs to CloudWatch Logs. The developer attaches an IAM role with a policy that allows logs:CreateLogGroup and logs:PutLogEvents. However, logs are not appearing. What is the most likely cause?
⚠ Common exam trap
Test-takers frequently assume `logs:CreateLogGroup` and `logs:PutLogEvents` are sufficient, overlooking the mandatory `logs:CreateLogStream` permission required for the log stream creation step between group creation and event writing.
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 IAM policy does not include logs:CreateLogStream.
Lambda requires the `logs:CreateLogStream` permission to create a log stream within a log group before it can write log events. Without this permission, the function can create the log group but cannot create the individual log stream needed to store log entries, causing logs to silently fail to appear.
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 is not configured to use a VPC.
Why it's wrong here
Lambda functions, by default, execute within AWS's internal network and possess outbound internet access. CloudWatch Logs is an AWS service accessible over the public internet, or optionally via VPC endpoints. Therefore, a Lambda function does not require configuration within a Virtual Private Cloud (VPC) to send its logs to CloudWatch Logs; it can access the service directly from its default execution environment. This VPC configuration is entirely irrelevant to the function's ability to write logs.
- ✗
The IAM role does not have a trust policy that allows Lambda to assume it.
Why it's wrong here
A trust policy is an essential component of an IAM role, defining which entities are permitted to assume that role. If the trust policy were missing or incorrectly configured (e.g., not allowing 'lambda.amazonaws.com' to assume it), the Lambda function would fail to invoke at all, as it would be unable to assume its designated execution role. Since the question implies the function is running but specifically failing to write logs, this foundational invocation issue is not the specific cause of only the logging failure.
- ✓
The IAM policy does not include logs:CreateLogStream.
Why this is correct
For a Lambda function to successfully write logs to CloudWatch Logs, its execution role requires specific permissions. While `logs:PutLogEvents` is necessary to transmit the actual log data, the function also crucially needs `logs:CreateLogStream` to establish a new log stream within the designated log group if one does not already exist for that particular invocation or execution environment. Without this `CreateLogStream` permission, the function cannot initialize the required logging infrastructure, leading to a failure in log delivery, even if it possesses the permission to put events.
- ✗
The CloudWatch Logs log group does not exist.
Why it's wrong here
Lambda functions are designed to automatically create their default log groups (e.g., `/aws/lambda/function-name`) if they do not already exist, provided the associated execution role has the `logs:CreateLogGroup` permission. Even when a custom log group name is specified, Lambda can provision it on demand if the necessary permission is present in the role. Therefore, the non-existence of a CloudWatch Logs log group itself is not inherently a problem, as Lambda can often create it as part of its logging process.
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 |
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 24, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.