Event-based real-time cloud functions examples

APIENDPOINT, APIKEY and STORAGECLIENTID need to be added as environment variables and should be accessible from the function. Please check Event-based handling for more details about these variables.

Amazon S3 lambda function setup

For creating a AWS lambda function, follow the official documentation: https://aws.amazon.com/getting-started/hands-on/run-serverless-code/

Function trigger needs to be set to all objects created events in order to receive notification only for newly added files.

Python function example:

Python
Copy

Azure Blob function app setup

To deploy the Azure function app, please use the following Terraform script: https://github.com/OPSWAT/metadefender-k8s/tree/main/terraform/azure-function-docker

STORAGECLIENTID, APIKEY and APIENDPOINT variables should be configured on .tvars file:

Python
Copy

Azure Blob Event Grid RTP configuration

For a detailed example, please use the example here: https://github.com/OPSWAT/metadefender-k8s/tree/main/terraform/CloudFunctions/Azure/webhook-notification

Event Notifications for Page and Append blob is not supported.

For Page and Append blobs, an event is sent as soon as the first block is committed to the storage, which can result in events being sent before the upload is complete.

Google Cloud function setup

The google.cloud.storage.object.v1.finalizedtrigger needs to be setup for the Cloud Function(v2), in order to process newly added objects.

Python function example:

Python
Copy

Alibaba Cloud function setup

Follow the official Alibaba documentation for creating a compute function with OSS trigger: https://www.alibabacloud.com/help/en/function-compute/latest/configure-an-oss-trigger

When the function compute is created, it is necessary to specify the bucket to monitor and to subscribe to the following event oss:ObjectCreated:*

Python function example:

Python
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard