I'm implementing a file upload workflow using Amazon S3 and want to integrate AWS GuardDuty for malware protection. The goal is to automatically scan uploaded files and delete any that are flagged as infected.
Here’s what I’ve done so far:
Files are uploaded to a private S3 bucket using pre-signed URLs. GuardDuty is enabled for malware protection on the bucket. I’ve configured lifecycle rules to delete objects tagged with THREATS_FOUND=true. Questions:
How can I ensure GuardDuty tags infected files correctly for lifecycle rules to trigger? Is there a recommended way to automate deletion beyond lifecycle rules (e.g., using EventBridge + Lambda)? Are there any limitations or best practices for using GuardDuty malware protection with S3 buckets? Any guidance or examples would be appreciated!