AWS Lambda function which will scan and sort objects incoming an S3 bucket into "clean" and "dirty" buckets in near-realtime.
You will need a working deployment of the APIScanner project which accepts REST API calls and scans objects against your Skyhigh Secure Web Gateway (SWG). See ScannerAPI.
- A source bucket where the unscanned files land
- A "clean" bucket to store files that are scanned with no malware found
- A "dirty" bucket to quarantine files that are scanned with malware found
We've tested with the following model:
- S3 bucket configured to send object create events to an SNS topic
- An SQS queue is created and subscribed to the SNS topic
- New SQS entries invoke the Lambda function
- Paste the function code into a Python Lambda function
- Modify the mwgscan_endpoint, clean_bucket_name, and dirty_bucket_name variables to match your deployment
- Ensure the function has read/write access to the S3 buckets
- Ensure you have a layer which includes the 'requests' library for Python
- Configure your SQS queue to invoke the function