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

Prerequisites

MNS is activated.

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

Background information

When you use event notification, take note of the following items:
  • You are charged by MNS when you use event notification. For more information, see Pricing.
  • The event notification feature is available in all regions except for the China (Heyuan), China (Guangzhou), China (Hohhot), China (Ulanqab), UAE (Dubai), and Malaysia (Kuala Lumpur) regions.
  • You can configure up to 10 event notification rules in a region.
  • Notifications are not sent for TS and M3U8 objects that are generated in RTMP-based stream ingest. For more information about RTMP-based stream ingest, see Overview.

For more information about event notification, see Event notification.

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 described in the following table.
    Parameter Description
    Rule Name Specify the name of the event notification rule.

    The name of each event notification rule created by 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 be notified 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 events that can trigger the rule. You can also configure multiple event notification rules for an object. When you configure multiple event notification rules for an object, 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.

    For more information about the events, see Events.

    Resource Description Specify the objects to which the event notification rule applies.
    • Select Full Name to apply the rule to an object that has 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 prefixes and suffixes.
      • 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, click Add. You can create up to five Resource Description entries.

    Endpoint Configure 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 about 10 minutes.