How I Cut a Days-Long Malware-Scanning Build to Under an Hour
A build that used to take days of console work now takes one Terraform apply, in under an hour. And when the policy changes, it no longer means a rebuild. Here's how I got there, and what real environments taught me along the way. The problem: the requirements kept moving Every file that enters a secure network has to be scanned before anyone uses it. My team calls the system that does this the…
A multi-day malware scanning build has been reduced to an hour-long process using Terraform. The system automatically scans all files entering a secure network before they are used. Initially, the washing machine had to be shared across all enclaves, but later it was designed to be either shared or per-enclave based on the policy.
GuardDuty Malware Protection for S3 scans new objects in a landing bucket and tags the result. Two AWS Lambda functions in private subnets handle the transfer of clean files and quarantine of those that cannot be scanned. An Amazon EventBridge rule sends the result to these Lambda functions, and Amazon CloudWatch alarms monitor for Lambda errors.
The code is built using a single Terraform module, allowing for easy deployment in shared or individual enclave accounts. Guardrails were implemented to exempt the GuardDuty scan role from access denials, and VPC endpoints were added to handle private subnets. A test virus, the EICAR test file, was uploaded after every deployment to ensure the pipeline was working correctly.
Using Terraform has resulted in faster reviews, as reviewers can now read the code and plan instead of looking at screenshots. The default template for every new enclave has been created, resulting in faster deployment times and increased trust from customers.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.