How to Scan an AWS S3 File for Viruses in Python

When you store business data in AWS S3, you want the content to be safe and secure. However, with new virus signatures popping up daily, it’s increasingly difficult to ensure that safety — this is where we come in. Utilizing the following API in Python, you will be able to quickly identify if the content of your AWS S3 file has been infected, which will enable you to eradicate the threat and prevent it from leaking to other business critical applications.

Image for post
Image for post

To install the Cloudmersive API, run this command to install the SDK:

pip install cloudmersive-virus-api-client

Next, you can call the function using the following code. Please note you will need to fill in the access key, secret key, bucket region, bucket name, and key name to instance the API.

from __future__ import print_function
import time
import cloudmersive_virus_api_client
from import ApiException
from pprint import pprint

This will generate an instant response which will indicate if your file is infected, and if it is, the response will also identify which virus is responsible so you can address it. To retrieve the API Key, you can head to the Cloudmersive website to create an account and receive access to 800 free monthly calls across our library of APIs.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store