This module contains the AWS Lambda implementation for scanning S3 objects for viruses using ClamAV. Built with Java 25, this high-performance, serverless function uses a container-based deployment and leverages the AWS SDK v2 Async Client with CRT (Common Runtime) for optimal performance.
- ✅ Java 25 with virtual thread readiness
- 🔬 ClamAV integration (with up-to-date virus definitions)
- ☁️ Asynchronous S3 interactions via
S3AsyncClient+ CRT (zero-copy, event-driven I/O) - 🐳 Container-based Lambda deployment using the Java 25 Lambda base image with AL2023-native ClamAV packages
- 🧠 Smart object tagging: adds
scan-statustags such asSCANNING,CLEAN,INFECTED,ERROR, orFILE_SIZE_EXCEEEDdepending on config and outcome - ⚡ Parallel processing: Uses
CompletableFuturefor high concurrency - 🧼 /tmp-safe: Streams S3 content directly to
/tmp, deletes after scan
- Triggered by S3 Event Notification
- Downloads file to Lambda
/tmpusingS3AsyncClient - Executes
clamscanin a native container image with preloaded virus definitions - Parses output and only treats the scan as infected when ClamAV reports a real
FOUNDsignature - Tags file in-place with
scan-statuswhen configured to do so
The target/lambda-1.0.jar file is automatically copied to the CDK module during Maven build to be included in the container image.
- Java 25
- AWS SDK v2 with CRT
- Log4j2
- Maven Shade Plugin
- ClamAV
- Docker & AWS Lambda Container Images