Skip to main content

Configure event notifications

Contributors netapp-lhalbert

You enable notifications for a bucket by creating notification configuration XML and using the Tenant Manager to apply the XML to a bucket.

Before you begin
  • Platform services were enabled for your tenant account by a StorageGRID administrator.

  • You have already created a bucket to act as the source of notifications.

  • The endpoint that you intend to use as a destination for event notifications already exists, and you have its URN.

  • You belong to a user group that has the Manage all buckets or Root access permission. These permissions override the permission settings in group or bucket policies when configuring the bucket using the Tenant Manager.

About this task

You configure event notifications by associating notification configuration XML with a source bucket. The notification configuration XML follows S3 conventions for configuring bucket notifications, with the destination Kafka or Amazon SNS topic specified as the URN of an endpoint.

For general information about event notifications and how to configure them, refer to the Amazon documentation. For information about how StorageGRID implements the S3 bucket notification configuration API, refer to the instructions for implementing S3 client applications.

Note the following requirements and characteristics when configuring event notifications for a bucket:

  • When you create and apply valid notification configuration XML, it must use the URN of an event notifications endpoint for each destination.

  • Although event notification can be configured on a bucket with S3 Object Lock enabled, the S3 Object Lock metadata (including Retain Until Date and Legal Hold status) of the objects won't be included in the notification messages.

  • After you configure event notifications, whenever a specified event occurs for an object in the source bucket, a notification is generated and sent to the Amazon SNS or Kafka topic used as the destination endpoint.

  • If you enable event notifications for a bucket that contains objects, notifications are sent only for actions that are performed after the notification configuration is saved.

Steps
  1. Enable notifications for your source bucket:

    • Use a text editor to create the notification configuration XML required to enable event notifications, as specified in the S3 notification API.

    • When configuring the XML, use the URN of an event notifications endpoint as the destination topic.

      <NotificationConfiguration>
        <TopicConfiguration>
           <Id>Image-created</Id>
           <Filter>
              <S3Key>
                <FilterRule>
                  <Name>prefix</Name>
                  <Value>images/</Value>
                </FilterRule>
              </S3Key>
          </Filter>
          <Topic>arn:aws:sns:us-east-1:050340950352:sgws-topic</Topic>
          <Event>s3:ObjectCreated:*</Event>
         </TopicConfiguration>
       </NotificationConfiguration>
  2. In the Tenant Manager, select STORAGE (S3) > Buckets.

  3. Select the name of the source bucket.

    The bucket details page appears.

  4. Select Platform services > Event notifications.

  5. Select the Enable event notifications checkbox.

  6. Paste the notification configuration XML into the text box, and select Save changes.

    Note Platform services must be enabled for each tenant account by a StorageGRID administrator using the Grid Manager or Grid Management API. Contact your StorageGRID administrator if an error occurs when you save the configuration XML.
  7. Verify that event notifications are configured correctly:

    1. Perform an action on an object in the source bucket that meets the requirements for triggering a notification as configured in the configuration XML.

      In the example, an event notification is sent whenever an object is created with the images/ prefix.

    2. Confirm that a notification has been delivered to the destination Amazon SNS or Kafka topic.

      For example, if your destination topic is hosted on the Amazon SNS, you could configure the service to send you an email when the notification is delivered.

      {
         "Records":[
            {
               "eventVersion":"2.0",
               "eventSource":"sgws:s3",
               "eventTime":"2017-08-08T23:52:38Z",
               "eventName":"ObjectCreated:Put",
               "userIdentity":{
                  "principalId":"1111111111111111111"
               },
               "requestParameters":{
                  "sourceIPAddress":"193.51.100.20"
               },
               "responseElements":{
                  "x-amz-request-id":"122047343"
               },
               "s3":{
                  "s3SchemaVersion":"1.0",
                  "configurationId":"Image-created",
                  "bucket":{
                     "name":"test1",
                     "ownerIdentity":{
                        "principalId":"1111111111111111111"
                     },
                     "arn":"arn:sgws:s3:::test1"
                  },
                  "object":{
                     "key":"images/cat.jpg",
                     "size":0,
                     "eTag":"d41d8cd98f00b204e9800998ecf8427e",
                     "sequencer":"14D90402421461C7"
                  }
               }
            }
         ]
      }

      If the notification is received at the destination topic, you have successfully configured your source bucket for StorageGRID notifications.