Oracle Cloud Infrastructure Documentation

Getting Started with Events

This topic introduces you to creating automation with Events. You create a simple rule that sends a notification whenever someone creates a bucket in a particular compartment in your tenancy.

Warning

Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.

Setting Up for Events

To try out the Events service for this tutorial, you must have these things set up first:

  • Create IAM policy for Events
  • Create a topic and subscription to use as an action

Important

A tenancy administrator must configure your tenancy for Events. These configurations give you access to an Oracle Cloud Infrastructure tenancy with the necessary IAM policy and a resource to use as an action.

Create Users, Groups, and Compartments

You can use existing users, groups, and compartments or make new ones.

To create groups and users
To create a compartment

Create IAM Policies for Events

Before users can start using Events to create automation, as a tenancy administrator you must create two types of IAM policies: 

  • IAM policy for users so that they can create and manage rules.
  • IAM policy for the Events service so that it can deliver event messages to action resources, which can be any combination of topics, streams, or functions. (For this tutorial, you will only deliver events to a topic.)
To create a policy that allows users to create and manage rules
To create a policy that allows the Events service to deliver event messages to a topic

Create Notifications Topic and Subscription

If a suitable Notifications topic doesn't already exist, then you must log in to the Console as a tenancy administrator and create it. Whether you use an existing topic or create a new one, add an email address as a subscription so that you can monitor that email account for notifications.

To create a topic
To create a subscription
To confirm a subscription

Using the Console to Create a Rule

Use the Console to create a rule with a pattern that matches bucket creation events emitted by Object Storage. Specify the Notifications topic you created as an action to deliver matching events. To test your rule, create a bucket. Object Storage emits an event which triggers the action. Check the email specified in the subscription to receive your notification.

To create a rule
To create a bucket
To receive your notification

Using the CLI to Create a Rule

When you use the CLI to create a rule, you work a little differently than using the Console.

  • To specify the actions for your rule, use a JSON formatted file. You create this file before you create the rule, and the file simplifies the amount of information you must type at the command line.
  • To specify an event to match, use a JSON formatted string. You type this right into the console as you create the rule.
To create an action file
To create a rule
To create a bucket
To receive your notification