DOP-C02 Monitoring and Logging Practice Question
A DevOps engineer manages a multi-account AWS Organization. The security team requires that all CloudWatch Logs log groups in every account retain data for at least 400 days and that no developer can shorten that retention. Which combination of actions should the engineer take?
⚠ Common exam trap
Many exam-takers confuse CloudWatch Logs data protection policies, which mask sensitive data, with retention controls that govern how long log events are stored.
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
✓
Apply a service control policy in AWS Organizations that denies logs:PutRetentionPolicy and logs:DeleteRetentionPolicy unless the request comes from a designated governance role, and enforce a baseline retention with AWS Config or a CloudFormation StackSet.
Service control policies provide preventive guardrails across an AWS Organization, so denying retention policy changes except for a governance role stops developers from shortening retention. A StackSet or AWS Config rule then enforces the 400-day baseline consistently. Reactive scripts, data protection, and per-account IAM policies do not deliver centralized prevention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Enable CloudWatch Logs data protection and configure a log group policy that blocks retention changes.
Why it's wrong here
Data protection policies mask sensitive data in log events; they do not govern retention settings. CloudWatch Logs resource policies control cross-account access, not the ability to call PutRetentionPolicy. Neither mechanism prevents a developer with logs permissions from shortening retention, so this does not meet the requirement.
- ✗
Set retention on each log group to 400 days using a script, and rely on IAM policies in each account to deny logs:PutRetentionPolicy.
Why it's wrong here
A script can set retention, but relying on per-account IAM policies is fragile because new accounts and new roles can be created without the deny. It also does not prevent an administrator in a member account from changing the policy. This lacks the centralized, tamper-resistant enforcement the security team requires.
- ✗
Create an AWS Lambda function in each account that runs hourly, detects retention changes, and restores 400 days, and subscribe the function to an Amazon SNS topic.
Why it's wrong here
A reactive Lambda can correct drift after the fact, but there is a window in which logs could be deleted, and the function itself needs permissions that could be abused. It also must be deployed and maintained per account and does not prevent the change. Preventive controls are required for this compliance scenario.
- ✓
Apply a service control policy in AWS Organizations that denies logs:PutRetentionPolicy and logs:DeleteRetentionPolicy unless the request comes from a designated governance role, and enforce a baseline retention with AWS Config or a CloudFormation StackSet.
Why this is correct
SCPs set the maximum permissions for member accounts, so denying retention changes except for a governance role prevents developers from shortening retention. Combined with a StackSet or Config rule that establishes the 400-day baseline, this gives centralized, drift-resistant enforcement across all accounts, including future ones, which matches the requirement.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
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.