How to Scan an AWS S3 File for Viruses in C#
When utilizing an AWS S3 file to store valuable business content, you need to guarantee your data isn’t being corrupted by viruses, malware, spyware, or other emerging threats. Our cloud storage virus scan API provides superior visibility into the safety status of your file by leveraging continuously updated signatures for millions of threats; by proactively identifying the virus, you can also prevent potential flow to other important business applications.
Run this command to install the SDK with .NET Framework:
Install-Package Cloudmersive.APIClient.NET.VirusScan -Version 3.0.3
Next, you can call the ScanCloudStorage function using the following code:
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.VirusScan.Api;
using Cloudmersive.APIClient.NET.VirusScan.Client;
using Cloudmersive.APIClient.NET.VirusScan.Model;namespace Example
{
public class ScanCloudStorageScanAwsS3FileExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");var apiInstance = new ScanCloudStorageApi();
var accessKey = accessKey_example; // string | AWS S3 access key for the S3 bucket; you can get this from My Security Credentials in the AWS console
var secretKey = secretKey_example; // string | AWS S3 secret key for the S3 bucket; you can get this from My Security Credentials in the AWS console
var bucketRegion = bucketRegion_example; // string | Name of the region of the S3 bucket, such as 'US-East-1'
var bucketName = bucketName_example; // string | Name of the S3 bucket
var keyName = keyName_example; // string | Key name (also called file name) of the file in S3 that you wish to scan for virusestry
{
// Scan an AWS S3 file for viruses
CloudStorageVirusScanResult result = apiInstance.ScanCloudStorageScanAwsS3File(accessKey, secretKey, bucketRegion, bucketName, keyName);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ScanCloudStorageApi.ScanCloudStorageScanAwsS3File: " + e.Message );
}
}
}
}
Once your virus scan is completed, you will either receive a virus identification or an indicator that your file is in the clear. Check out the Cloudmersive website to retrieve your API Key at no cost and with no commitment. We’ve got you covered with up to 800 monthly calls across our library of APIs.