Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For DVA-C02 candidates, the confusion often lies in how S3 versioning interacts with lifecycle policies versus direct application control. In production, this is about knowing exactly how to manage object versions efficiently without needing to change client code. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
DataPulse Inc., a fintech startup, stores transactional log files in an Amazon S3 bucket. The log files are updated multiple times per day by their backend service running on an on-premises server. DataPulse has enabled S3 Versioning on the bucket to protect against accidental overwrites. Over time, multiple versions of the same log file accumulate in the bucket. The engineering team wants to keep only the most current version of each log file plus the immediately preceding version for audit purposes. Older versions beyond these two should be automatically removed.
The Requirement: #
Design a solution that retains only the latest object version and one previous version in the S3 bucket without requiring code changes on the backend service.
The Options #
- A) Configure an S3 bucket policy to retain one newer noncurrent version of the objects.
- B) Configure an S3 Lifecycle rule to retain one newer noncurrent version of the objects.
- C) Enable S3 Object Lock. Configure an S3 Object Lock policy to retain one newer noncurrent version of the objects.
- D) Suspend S3 Versioning. Modify the application code to check the number of object versions before updating the objects.
Google adsense #
leave a comment:
Correct Answer #
B) Configure an S3 Lifecycle rule to retain one newer noncurrent version of the objects.
Quick Insight: The Developer Imperative #
For DVA-C02 candidates, this question tests your knowledge of how S3 Lifecycle rules can automatically manage noncurrent object versions without changing client-side logic. Bucket policies control permissions but do not enforce retention or deletion of versions. Object Lock enforces immutability, which is unnecessary here. Disabling versioning removes version control altogether, which breaks requirements.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option B
The Winning Logic #
This problem boils down to how to automatically retain exactly two versions: the current version and the immediately previous version.
- S3 Lifecycle rules allow you to define a NoncurrentVersionExpiration policy that can retain a specified number of previous versions and delete older ones. You can configure it to keep only one noncurrent version.
- This means the bucket automatically deletes any version older than the most recent previous version without any client-side code changes.
- Lifecycle policies run automatically, freeing your devs from managing version clean-up logic or manual interventions.
- Unlike bucket policies, lifecycle rules can enforce retention and expiration, not just control access.
- Object Lock is primarily for compliance immutability, which is overkill here and complicates management.
- Suspending versioning will cause all new objects to overwrite previous ones without preservation, breaking the version retention requirement.
The Trap (Distractor Analysis): #
- Why not A? Bucket policies only control permissions (who can read or write objects) and cannot delete or retain object versions. They do not provide lifecycle management.
- Why not C? Object Lock is for legal hold or regulatory immutability; it does not facilitate selective retention of version history. It could block deletions entirely.
- Why not D? Suspending versioning removes version control. Also, modifying the application to manage versions complicates deployment and introduces technical debt. Lifecycle policies are designed exactly for this use case.
The Technical Blueprint #
# Example AWS CLI command to create an S3 lifecycle rule keeping 1 previous version only:
aws s3api put-bucket-lifecycle-configuration --bucket datapulse-logs \
--lifecycle-configuration '{
"Rules": [
{
"ID": "KeepRecentVersionsOnly",
"Status": "Enabled",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 1
}
}
]
}'
Note: The NoncurrentDays parameter specifies how many days a noncurrent version will be retained before deletion. Combine it with testing version timestamps to ensure only the immediately previous version persists.
The Comparative Analysis #
| Option | API/Config Complexity | Performance Impact | Use Case Fit |
|---|---|---|---|
| A | Low (Bucket policy) | None | Cannot manage version lifecycle |
| B | Moderate (Lifecycle) | Automatic cleanup | Precisely fits version retention need |
| C | High (Object Lock) | High enforcement | For regulatory compliance, not retention |
| D | High (Code change) | Manual intervention | Removes versioning, breaks requirements |
Real-World Application (Practitioner Insight) #
Exam Rule #
For the exam, always pick S3 Lifecycle rules when you need to automatically retain or delete noncurrent S3 object versions.
Real World #
In production, you rarely change client code for version management once versioning is enabled. Lifecycle rules give a scalable, automated way to clean up old versions and control storage costs without complexity.
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the AWS DVA-C02 exam.