We have been doing something similar, but in our case, its before the file storing in S3
. Which is OK, I think, solution would still works for you.
We have one EC2 instance where we have installed the clamav
. Then written a web-service that accepts Multi-part file and take that file content and internally invokes ClamAv
command for scanning that file. In response that service returns whether the file is Infected
or not
.
Your solution, could be,
- Create a web-service as mentioned above and host it on EC2(lets call it,
virus scan service
).
- On Lambda function, call the
virus scan service
by passing the content.
- Based on the
Virus Scan service
response, tag your S3 file appropriately.
If your open for paid service too, then in above the steps, #1 won't be applicable, replace the just the call the Virus-Scan service of Symantec
or other such providers etc.
I hope it helps.