How to Enable Malware Scanning for S3 Buckets Using GuardDuty
Last updated: March 24, 2025
AWS GuardDuty provides native malware scanning capabilities for S3 buckets. Here's how to set it up and implement access controls based on scan results.
Enabling GuardDuty Malware Protection
GuardDuty Malware Protection can be enabled on a per-bucket basis through the AWS Console. This feature will automatically scan objects uploaded to your S3 buckets and tag them with scan results.
How It Works
When enabled, GuardDuty will:
Automatically scan new objects uploaded to the configured S3 buckets
Tag scanned objects with results (e.g., NO_THREATS_FOUND)
Allow you to implement access controls based on scan results
Implementing Access Controls
The recommended way to control access to scanned files is by implementing a bucket policy that denies access to objects that haven't been marked as safe. You can create a policy that only allows access to objects tagged with 'NO_THREATS_FOUND'.
For detailed implementation instructions, refer to the official AWS documentation: