Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex Serverless Containers
  • Comparison with other Yandex Cloud services
  • Getting started
  • Step-by-step instructions
  • Concepts
    • Overview
    • Container
    • Invoking a container
    • Networking
    • Runtime environments
    • Trigger
      • Overview
      • Timer
      • Trigger for Message Queue
      • Trigger for Object Storage
      • Trigger for Container Registry
      • Trigger for Cloud Logging
      • Trigger for Yandex IoT Core
      • Trigger for budgets
      • Trigger for Data Streams
      • Email trigger
    • Dead Letter Queue
    • Container logs
    • Backups
    • Quotas and limits
  • Practical guidelines
  • Access management
  • Pricing policy
  • Containers API reference
  • API Triggers reference
  • Questions and answers
  1. Concepts
  2. Trigger
  3. Trigger for Object Storage

Trigger for Object Storage that invokes a Serverless Containers container

Written by
Yandex Cloud
  • Events for setting up a trigger
    • Filtering events by object
  • Roles required for the proper operation of a trigger for Object Storage
  • Trigger for Object Storage message format
  • See also

Triggers for Object Storage invoke a Serverless Containers container when a certain event occurs with a Object Storage object. The trigger must be in the same cloud as the bucket whose events it's subscribed to.

A trigger for Object Storage needs a service account to invoke the container.

Events for setting up a trigger

Events with bucket objects that can be tracked using a trigger:

  • Creating an object.
  • Editing an object ACL.
  • Deleting an object.

Filtering events by object

Events are filtered using prefixes and suffixes for an object key.

  • The prefix is the part of the object key that contains the beginning of the object key.
  • The suffix is the part of the object key that contains the end of the object key.

Prefixes and suffixes can be any length. When using a prefix and suffix at the same time, filtering is done based on the logical AND: for the trigger to work, the object key must match both the prefix and suffix.

Roles required for the proper operation of a trigger for Object Storage

  • To create a trigger, you need a permission for a service account that runs the trigger executing the operation. This permission is included in the iam.serviceAccounts.user and editor roles and higher.
  • To run a trigger, the service account needs the serverless.containers.invoker role for the folder with the container to be invoked by the trigger.

Read more about access management.

Trigger for Object Storage message format

After the trigger is activated, it sends the following message to the container:

{
  "messages": [
    {
      "event_metadata": {
        "event_id": "bb1dd06d-a82c-49b4-af98-d8e0c5a1d8f0",
        "event_type": "yandex.cloud.events.storage.ObjectDelete",
        "created_at": "2019-12-19T14:17:47.847365Z",
        "tracing_context": {
          "trace_id": "dd52ace79c62892f",
          "span_id": "",
          "parent_span_id": ""
        },
        "cloud_id": "b1gvlrnlei4l5idm9cbj",
        "folder_id": "b1g88tflru0ek1omtsu0"
      },
      "details": {
        "bucket_id": "s3-for-trigger",
        "object_id": "dev/0_15a775_972dbde4_orig12.jpg"
      }
    }
  ]
}

See also

  • Trigger for Object Storage that invokes a Cloud Functions function.

Was the article helpful?

Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
In this article:
  • Events for setting up a trigger
  • Filtering events by object
  • Roles required for the proper operation of a trigger for Object Storage
  • Trigger for Object Storage message format
  • See also