OCI Events: Email Notification for Object Storage Updates
Oracle object storage is used in daily tasks like uploading
backup data, archiving data, purging old data, etc. It will be very useful if
we get notified about the changes happening in object storage. We can achieve
this through OCI events. In this article we will go through the steps to
configure OCI events for Object storage updates.
Object Storage Bucket → OCI Events Rule → OCI Notifications
Topic → Email Alert
Whenever a new object is created in an OCI Object Storage
bucket, OCI can generate an event, match it with an Events rule, and send an
email notification through the Notifications service. OCI Events is designed to
create notification based on resource state changes, and Object Storage
supports emitting events for object state changes at the bucket level.
1)
Create an Object Storage Bucket
In the OCI console, open the
navigation menu and move to Storage → Buckets. Select the compartment and click
Create Bucket. Enter a bucket name and click Create
We will create events to capture the updates in this bucket.
2) Enable Event Emission for Object State Changes
For Object Storage to
participate in this workflow, the bucket must emit events for object state
changes. In the bucket details page, click Emit object events.
Click Enable button.
Now we could see Emit Object
Events status is enabled in the console.
This allows OCI to generate an event when an object is
created, updated, or deleted in the bucket.
3) Create an OCI
Notifications Topic
Next, create a topic that will receive messages from OCI
Events.
In the OCI console, move to Developer Services -> Application
Integration -> Notification services.
Click Topics and click Create
Topic. Enter a topic name and click Create.
OCI Notifications uses topics as logical channels for
publishing messages to subscribers.
4) Add an Email
Subscription
The next step is to add email as a subscriber to the topic.
Click the newly created topic and
click Create Subscription.
Select protocol Email and enter
email address that has to receive notification and click Create.
OCI will send a confirmation email to that address. The
subscription remains pending until we confirm it.
5) Confirm the Email
Subscription
The email subscription will send a confirmation email to prescribed
email ID. Open the confirmation email sent by OCI Notifications and click the
confirmation link.
After confirming, In the OCI
console, refresh the subscription page and verify the subscription status shows
as Active. This step is mandatory, without this confirmation step, the email
notifications will not be delivered.
6) Create an OCI
Events Rule
Now let’s create the rule that connects Object Storage
events to the Notifications.
In the OCI console, choose Observability
& Management → Events Service → Rules
Click Create Rule, enter a name and choose the event type
related to Object Storage object creates.
For the action, choose Notifications and select the topic
created earlier and click Create
7) Upload a File to the Bucket
Let’s test it now. In Object
Storage bucket, Click Upload and Choose a file to upload and click Upload.
Once the object is created,
OCI should emit the event, the Events rule should match it, and Notifications
should send an email to the subscribed address. We can also enable notification
for object delete, update.
8) Verify the Email
Notification
Check the mail inbox for the email notification generated by
OCI. The below notification has been received for deleting an object from bucket.
At this point, we have a working event driven automation
flow in your OCI tenancy.
No comments:
Post a Comment