AWS Certified Data Engineer – AssociateData Governance and SecurityMedium
A media company stores large volumes of video assets in an S3 bucket. Due to contractual agreements, certain video categories must be permanently deleted exactly 5 years after their creation date, regardless of whether they have been accessed. Other categories have no such deletion requirement. How can the data engineering team automate this selective and precise deletion of specific video categories?
- AImplement a daily AWS Lambda function triggered by CloudWatch Events to scan the S3 bucket and delete objects older than 5 years based on their metadata.
- BConfigure S3 Event Notifications to trigger an AWS Step Functions workflow that deletes objects after 5 years based on their bucket prefix.
- CApply a single S3 lifecycle policy with a filter for the object creation date and an expiration action set to 5 years.
- DUse S3 object tagging to identify the specific video categories and apply an S3 lifecycle policy with a tag filter and an expiration action set to 5 years.
Show answer & explanationAnswer & explanation
Correct answer: D. Use S3 object tagging to identify the specific video categories and apply an S3 lifecycle policy with a tag filter and an expiration action set to 5 years.
S3 lifecycle policies can be filtered by object tags. By tagging the specific video categories that need to be deleted after 5 years, a lifecycle policy can be configured to expire only those objects, meeting the requirement for selective and precise deletion.
Why the other options are wrong
- A. While a Lambda function could achieve this, it's a more complex and potentially less cost-effective solution than native S3 lifecycle policies for simple expiration based on age, and involves custom code maintenance.
- B. S3 Event Notifications and Step Functions could be used for more complex workflows, but for simple time-based expiration of tagged objects, S3 lifecycle policies are the more native, simpler, and cost-effective solution.
- C. A single lifecycle policy without a filter would apply to all objects in the bucket, which does not meet the 'selective' deletion requirement.
S3 Lifecycle Policy Tag Filters
S3 Lifecycle policies can use object tags as filters to apply rules to a subset of objects within a bucket, enabling fine-grained control over storage class transitions and object expiration.
- Apply rules to objects matching specific key-value tag pairs
- Allows selective management of objects within a single bucket
- Combines with object age for precise actions
Memory trick: Tags filter S3 lifecycle to delete selected videos.