Courseiva
Continuous Improvement for Existing SolutionsmediumMultiple ChoiceObjective-mapped

SAP-C02 Continuous Improvement for Existing Solutions Practice Question

Network Topology
$ aws logs describe-log-groupslog-group-name-prefix /aws/lambda/my-functionRefer to the exhibit.```"logGroups": ["logGroupName": "/aws/lambda/my-function","creationTime": 1704067200000,"metricFilterCount": 1,"arn": "arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-function:*","storedBytes": 1048576,"retentionInDays": 30

A Lambda function logs are being retained for 30 days. The company wants to reduce costs by deleting logs older than 7 days. What should they do?

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

Use the put-retention-policy command to set retentionInDays to 7.

The exhibit shows the log group has a retention policy of 30 days. To change it to 7 days, use the put-retention-policy CLI command. Option B is correct. Option A (CloudTrail) is for API logs. Option C (S3 lifecycle) is for objects, not CloudWatch Logs. Option D (export to S3) is for archival, not deletion.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Export the logs to S3 and delete the log group.

    Why it's wrong here

    Exporting is for archival, not for managing retention within CloudWatch Logs.

  • Use the put-retention-policy command to set retentionInDays to 7.

    Why this is correct

    This command directly sets the log group's retention period.

  • Configure an S3 Lifecycle policy on the log group's underlying storage.

    Why it's wrong here

    CloudWatch Logs are not stored in S3 buckets.

  • Create a CloudTrail trail to capture log events and expire them after 7 days.

    Why it's wrong here

    CloudTrail is for API activity, not CloudWatch Logs retention.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

This SAP-C02 question is part of Courseiva's 1,660-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SAP-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 SAP-C02 exam.