Question 748 of 1,511
Lambda IAM Policy for CloudWatch Logs: Missing CreateLogGroup Permission
Exhibit
Refer to the exhibit.
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "logs:PutLogEvents",
"Resource": "arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-function:*"
}
]
}
```A Lambda function is unable to write logs to CloudWatch Logs. The IAM policy attached to the function's execution role is shown above. What is the issue?
Quick Answer
The answer is that the Lambda IAM policy for CloudWatch Logs is missing the `logs:CreateLogGroup` and `logs:CreateLogStream` permissions. This is the issue because while the policy includes `logs:PutLogEvents` to write log data, it fails to grant the prerequisite actions needed to initialize the log stream and log group in CloudWatch Logs. Without these create permissions, the Lambda function cannot establish the destination for its logs, even though it has the write action. On the AWS Certified DevOps Engineer Professional DOP-C02 exam, this is a classic trap where candidates see `PutLogEvents` and assume all logging permissions are covered, but AWS requires explicit create permissions for the initial setup. A reliable memory tip is "Create before you Put" — think of it as needing to build the bucket before you can fill it with water.
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 policy is missing the 'logs:CreateLogGroup' and 'logs:CreateLogStream' actions.
The Lambda function's execution role must include permissions for 'logs:CreateLogGroup' and 'logs:CreateLogStream' in addition to 'logs:PutLogEvents' to write logs to CloudWatch. The provided policy likely only grants 'logs:PutLogEvents', which allows writing to existing log streams but not creating the log group or stream. Option A is incorrect because the resource ARN can be generalized to the log group or stream without specifying the stream name. Option B is incorrect because the region mismatch would cause a different error. Option C is incorrect because the action 'logs:PutLogEvents' is necessary but not sufficient; the missing create actions are the issue.
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 resource ARN is incorrect; it should include the log stream name.
Why it's wrong here
The ARN can include a wildcard for the log stream.
- ✗
The region in the ARN does not match the Lambda function's region.
Why it's wrong here
The region is specified as us-east-1.
- ✗
The action should be 'logs:PutLogEvents' but the resource is too restrictive.
Why it's wrong here
The action is correct; the issue is missing create permissions.
- ✓
The policy is missing the 'logs:CreateLogGroup' and 'logs:CreateLogStream' actions.
Why this is correct
Lambda needs to create the log group and stream before writing events.
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 →
Same concept, more angles
1 more way this is tested on DOP-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A DevOps engineer is troubleshooting why an AWS Lambda function is not writing logs to the CloudWatch Logs log group 'MyAppLogs'. The Lambda function's execution role includes the IAM policy shown in the exhibit. What is the MOST likely reason the logs are not being written?
hard- A.The log group is in a different AWS Region.
- ✓ B.The policy does not grant permission to create the log group or put log events to the log group itself.
- C.The policy has an incorrect action name.
- D.The policy is missing the 'logs:CreateLogGroup' action.
Why B: The Lambda function's execution role policy allows actions like logs:CreateLogGroup and logs:PutLogEvents on log streams within the log group (e.g., arn:aws:logs:region:account-id:log-group:MyAppLogs:log-stream:*), but does not grant permission to create the log group itself or put log events directly to the log group resource (arn:aws:logs:region:account-id:log-group:MyAppLogs). For Lambda to write logs to CloudWatch, it needs logs:CreateLogGroup on the log group ARN (if the group does not exist) and logs:PutLogEvents on the log group ARN itself. Without these specific permissions, the logs cannot be written. Option A is incorrect because the region is irrelevant; the issue is with permissions. Option C is incorrect because the action names are valid. Option D is incorrect because the policy does include logs:CreateLogGroup, but it’s the resource specification that is insufficient.
Last reviewed: Jun 20, 2026
This DOP-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 DOP-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.