Antivirus for S3 Buckets

Michael Wittig – 18 Apr 2016

Many of our AWS consultancy clients ask me:

“How can we make sure that the files that we store on S3 are virus free?”

As always, our clients are looking for simple and cheap solutions. That’s why I developed S3 VirusScan. Every file that is added to an S3 bucket is automatically scanned.

The S3 VirusScan with additional integrations is available in the AWS Marketplace.

Cover of Amazon Web Services in Action

Level up, strengthen your AWS skills.

Our book Amazon Web Services in Action is a comprehensive introduction to computing, storing, and networking in the AWS cloud. You'll find clear, relevant coverage of all the essential AWS services, emphasizing best practices for security, high availability, and scalability. Get the first chapter for free!

Features

  • Uses ClamAV to scan newly added files on S3 buckets
  • Updates ClamAV database every 3 hours automatically
  • Scales EC2 instance workers to distribute workload
  • Publishes a message to SNS in case of a finding
  • Can optionally delete compromised files automatically
  • Logs to CloudWatch Logs

Commercial Features

  • CloudWatch Integration (Metrics and Dashboard)
  • Security Hub Integration
  • SSM OpsCenter Integration

The S3 VirusScan with additional integrations is available in the AWS Marketplace.

How does it work

A picture is worth a thousand words:

Architecture

  1. S3 VirusScan uses a SQS queue to decouple scan jobs from the ClamAV workers. Each S3 bucket can fire events to that SQS queue in case of new objects. This feature of S3 is called S3 Event Notifications.
  2. The SQS queue is consumed by a fleet of EC2 instances running in an Auto Scaling Group. If the number of outstanding scan jobs reaches a treshold a new ClamAV worker is automatically added. If the queue is mostly empty workers are removed.
  3. The ClamAV workers run a simple ruby script that executes the clamscan command. In the background the virus database is updated every three hours.
  4. If clamscan finds a virus the file is directly deleted (you can configure that) and a SNS notification is published.

Installation & Configuration

Read more about S3 VirusScan and learn how to install and configure our solution in minutes.

Tags: aws security s3
Michael Wittig

Michael Wittig

Consultant. Entrepreneur. Author. Focusing on Amazon Web Services (AWS) since 2013.

You can contact me via Email, Twitter, and LinkedIn.

Briefcase icon
Hire me