You can configure event notification rules for objects that you want to monitor in the Object Storage Service (OSS) console. If the events that you specify in the rules occur on these objects, you can receive notifications from the specified HTTP servers or Message Service (MNS) queues in real time.

Prerequisites

MNS is activated. You can go to the MNS product page to activate MNS.

Usage notes

  • You are charged by MNS when you use the event notification feature. For more information about the pricing, see Pricing.
  • The event notification feature is not supported in the following regions: China (Heyuan), China (Guangzhou), China (Hohhot), China (Ulanqab), UAE (Dubai), and Malaysia (Kuala Lumpur).
  • You can configure up to 10 event notification rules in a region.
  • Notifications are not sent for TS and M3U8 objects that are generated by ingesting streams over Real-Time Messaging Protocol (RTMP). For more information about RTMP-based stream ingest, see Overview.

For more information about the event notification feature, see Overview.

Procedure

  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket for which you want to configure event notification rules.
  3. In the left-side navigation pane, choose Basic Settings > Event Notification.
  4. In the Event Notification section, click Configure. On the page that appears, click Create Rule.
  5. In the Create Rule panel, configure the rule parameters that are described in the following table.
    Parameter Description
    Rule Name Specify the name of the event notification rule.

    The name of each event notification rule that is created by using the same Alibaba Cloud account must be unique in the same region. The name of an event notification rule must start with a letter and can contain only letters, digits, and hyphens (-). The name cannot exceed 85 characters in length.

    Events Select one or more events that can trigger the event notification rule from the drop-down list. For example, if you want to receive a notification when a specific object is created or overwritten by copying an object, select CopyObject.

    You can configure an event notification rule for a specific object and specify multiple types of events that can trigger the rule. You can also configure multiple event notification rules for an object. When you configure multiple event notification rules, take note of the following items:

    • If the multiple event notification rules apply to the same object, the values of this parameter in these rules must be different. For example, if you select CopyObject for Events when you create an event notification rule for objects whose names contain the images prefix, CopyObject cannot be selected for Events when you create another event notification rule for objects whose names contain the same prefix.
    • If the multiple event notification rules apply to different objects, the values of this parameter in these rules can be the same. For example, if you select PutObject for Events when you create an event notification rule for objects whose names contain the images prefix and the .png suffix, you can select PutObject or DeleteObject for Events when you create another event notification rule for objects whose names contain the log prefix and the .jpg suffix.
    Notice If you do not specify the version ID when you delete an object from a versioned bucket, the DeleteObject or DeleteObjects event notification is not triggered. In this case, no version of the object is deleted. The current version of the object is converted into a previous version and a delete marker is added to the object.

    For more information about the object operations that correspond to the event types, see Events.

    Resource Description Specify the objects to which the event notification rule applies.
    • Select Full Name to apply the rule to an object whose name matches the specified name.
      • To create a rule that applies to an object named exampleobject.txt in the root directory of the bucket, enter exampleobject.txt.
      • To create a rule that applies to an object named myphoto.jpg in the destdir directory within the root directory of the bucket, enter destdir/myphoto.jpg.
    • Select Prefix and Suffix to apply the rule to objects whose names contain the specified prefix and suffix.
      • To create a rule that applies to all objects in the bucket, leave Prefix and Suffix empty.
      • To create a rule that applies to all objects in the examplefolder directory within the root directory of the bucket, set Prefix to examplefolder/ and leave Suffix empty.
      • To create a rule that applies to all JPG objects in the bucket, leave Prefix empty and set Suffix to .jpg.
      • To create a rule that applies to all MP3 objects in the examplefolder directory within the root directory of the bucket, set Prefix to examplefolder/ and Suffix to .mp3.

    To create a Resource Description entry, click Add. You can create up to five Resource Description entries.

    Endpoint Specify the endpoint to which notifications are sent. Valid values: HTTP and Queue.
    • HTTP: Enter the address of the HTTP endpoint to which notifications are sent. Example: http://198.51.100.1:8080. For more information about how to enable an HTTP endpoint, see Manage topics and HttpEndpoint.
    • Queue: Enter the name of an MNS queue. For more information about how to create a queue, see Create a queue.

    To create an endpoint, click Add. You can create up to five endpoints.

  6. Click OK.
    After you configure the event notification rule, the rule takes effect after approximately 10 minutes.