Oracle Cloud Integrated Management Notification
Introduction
Description
Notifications should be an important part of any customers cloud infrastructure as they can save a lot of time and money. Notifications from applications can send emails or alerts to their users when something happens. For example: a file or order has been processed. That's a potential notification. A developer or DevOps Engineer might also want to know when something has changed in the infrastructure. For example, a DB backup has begun or completed. Notifications sometimes don't even involve users or developers. Notifications can help when customers have a serverless function that needs to run when an object is uploaded to Object Storage. There are many different activities that fall under the umbrella term "notification" and ONS can handle just about every scenario you can think of.
Overall Lab Objectives
- Create a notification including configuration of an Oracle cloud topic, subscription and event
Lab Overview Video
Watch this video to see an accelerated review of the tasks in this lab.
Resources
Contact us
Having an issue with the lab? Have an idea on how it could be made better? Want to tell us how awesome the lab is? Click the icon below to contact the team and let us know your feedback.
Task 1: Create a Notification
- Click the OCI console action menu located in the upper left corner of the console page, select Developer Services, then under Application Integration select Notifications.
- Select your assigned compartment from the List Scope drop down on the left side of the page. Click the +/- buttons to find your specific compartment. Select the compartment name that is listed underneath Luna-Labs.
A Topic is a communication channel for sending messages to the subscriptions in the topic. Each topic name is unique across the tenancy.
- Click on the Create Topic button.
- Name your topic and provide an optional description, then click the Create button.
- Verify that your topic appears in the dialog and review the information provided.
A subscription is an endpoint for a topic. Published messages are sent to each subscription for a particular topic. The following subscription protocols are currently supported:
- Email: Messages are sent to a specified email address.
- HTTPS (PagerDuty): Messages are sent to PagerDuty.
- HTTPS (Webhook) : Messages are sent to HTTPS endpoint.
- Slack: Messages are sent to a Slack channel
- Oracle Functions : Invoke an Oracle Function
- SMS : Messages are sent to an SMS enabled phone number
- Setup a subscriber to your topic. Select the Subscriptions link and click on the Create Subscription button.
- In a production environment, you might have many subscription topics. In our case we only have the topic you just configured so it should show up as the default. If not, choose
notification_topic
in the drop-down list. Choose Email as the protocol and type in your work email address. You need to provide a valid email to receive the notification messages. Click the Create button at the bottom of the page.
- A new Subscription will appear with its status as Pending.
- Check your email. Shortly you should receive a message titled Oracle Cloud Infrastructure Notifications Service Subscription Confirmation in your inbox. If not, check your junk email box. Open the message and click the Confirm subscription link.
- On the system where you're checking your email, a confirmation will appear in your web browser.
- Your subscription should update to active status. Refresh the browser if necessary to check if the status has changed.
Task 2: Create an Event
Oracle Cloud Infrastructure Events enables you to create automation based on the state changes of resources throughout your tenancy. Use Events to allow your development teams to automatically respond when a resource changes its state.
Here are some examples of how you might use Events:
- Send a notification to a DevOps team when a database backup completes.
- Convert files from one format to another when files are uploaded to an Object Storage bucket.
For this exercise you will create an event that will send you an email to let you know when a compute service has finished provisioning.
- Click on the OCI Action menu located in the upper left corner of the console page, select Observability & Management. Under the Events Service heading select Rules.
- On the Rules page, click the Create Rule button.
Fill out the dialog on the Create Rule page with the following information. There are three basic sections to the rule.
Enter a display name and a description for your rule. Call it
compute-notify-rule
if you wish.In the Rule Conditions section the Condition is
Event Type
, selectCompute
from the Service Name drop-down, and chooseInstance - Launch End
for the Event Type.In the Actions section select
Notifications
as the Action Type. Choose your assigned compartment from the Notifications Compartment list and select the Topic you created earlier from the list. It should be callednotification_topic
.
Note: in the drop-down lists, you can type the term you're looking for to quickly locate it instead of scrolling through the long lists.
- Once you select the Create Rule button, a page will be shown indicating that your rule is now active.
Task 3: Launch a compute instance
In this task, you will launch a compute instance to test your new rule.
- Click on the Action menu on the OCI console and select Compute then Instances.
- Ensure that your assigned compartment is selected and click the Create Instance button.
- Review the details and accept all defaults for this dialog. The dialog will provide a default name, network, ip information and more. The only thing you need to do on the Create compute instance dialog is tell it that we don't want to use SSH keys. We're just creating the instance, we're not going to actually login or use it for anything. Just as an example of launching the system is all we need. Choose the radio button for No SSH keys and click Create.
- Your instance will begin provisioning and you will see the orange icon labeled Provisioning.
- Wait a few moments until your system icon turns green and it enters the Running stage.
- Check your email for a notification like the one below alerting you to a system launch on the Oracle Cloud.
You have successfully created an event and a notification.
As an extra challenge, create an event and notification for when a compute instance is terminated. Then terminate the instance and see if you recieve a notification.
Summary of Learning
- You can utilize Oracle Cloud observability and management notification capabilities
- You've experienced first hand how service notifications are created
- You can demonstrate this service to others and illustrate how it can help business be more efficient
Contact us
Having an issue with the lab? Have an idea on how it could be made better? Want to tell us how awesome the lab is? Click the icon below to contact the team and let us know your feedback.