The latest cloud infrastructure announcements, technical solutions, and enterprise cloud insights.

  • February 25, 2020

Announcing Notifications Triggers for Serverless Functions

Kay Singh
Senior Product Manager

Today, we’re excited to announce the ability of the Oracle Cloud Infrastructure Notifications service to trigger Oracle Functions.

Oracle Functions is a functions-as-a-service (FaaS) platform that makes it easy for developers to write code that meets business needs without worrying about infrastructure. Oracle Functions manages the underlying infrastructure and scales it elastically to handle incoming service requests. When you use Oracle Functions, you’re billed only for the resources that are consumed when the function runs.

Notifications is a cloud-native messaging service that allows push-based messaging to email, PagerDuty, and HTTPS endpoints. The Notifications service provides first-class integrations with other Oracle Cloud Infrastructure services, such as Events and Monitoring. You can use these integrations to configure a Notifications service topic to deliver notifications of events and alarms to multiple endpoints, like email and PagerDuty, in a fan-out pattern.

Common Use Cases

In today’s cloud-enabled world, you expect your services to always be available. Quickly fixing issues in your cloud infrastructure is key to achieving this objective and is a part of a mature DevOps culture. But imagine your service on-call having to wake up at 3 a.m. to accomplish a simple task like resizing a compute instance to a shape with more memory. We believe in improving our customers’ experience so they can spend more time on productive things. With Notifications triggers for functions, you can now automate this scenario by writing code that resizes the compute instance.

Following are more sample use cases that you can accomplish with this integration:

  • Scale-up Oracle Autonomous Database storage by using an alarm on the storage utilization metric in the Monitoring service.
  • Use automatic volume healing to respond to a usage threshold for a block volume and trigger a function to create, attach, and logically extend that volume. Then send out a notification with new disk capacity details.
  • Publish custom messages for a service or function and trigger another function.

Diagram that shows creating a function as part of the notifications process.

Getting Started

If you use Oracle Cloud Infrastructure Notifications, you can use this feature in the Console, SDK, CLI, and API when creating a subscription. The following are some examples to help you get started.

Console: Create a Subscription for a Topic

When you create a subscription on a topic, select Function as the protocol type.

Screenshot that shows the Create Subscription button on the topic details page in the console.

Screenshot that shows the Create Subscription dialog box with Function selected as the protocol.

Then, select the compartment of the function and the function that you want to trigger.

Screenshot that shows the Create Subscription dialog box with values in the function compartment, function application, and function fields.

After the function subscription is created, it appears in the Console.

Screenshot that shows the subscription details page on the console.

Console: Create an Alarm

From the Monitoring page of the Console, click Alarm Definitions and then click Create Alarm.

Screenshot that shows the Create Alarm button on the alarm definitions page in the console.

Provide the necessary information for the alarm.

Screenshot that shows the Create Alarm dialog box with the Define alarm area in focus.

Then, create a notification on the alarm that points to the topic you created a subscription for.

Screenshot that shows the Create Alarm dialog box with the Notifications area in focus and the Create a topic link highlighted.

Screenshot that shows the Create Alarm dialog box with the Notifications area in focus and the Create a new topic and subscription fields highlighted.


Create a function subscription:

oci ons subscription create \
--compartment-id "<compartment-ocid>" \
--topic-id "<topic-ocid>" \
--protocol "ORACLE_FUNCTIONS" \
--subscription-endpoint "<function_ocid>"

Java SDK

Create a function subscription:

subscription = client.createSubscription(CreateSubscriptionRequest.builder()


Configure the protocol in your provider configuration as follows:

variable "subscription_protocol" {
  default = "ORACLE_FUNCTIONS"

Then, you can create a subscription with type Oracle_Functions:

resource "oci_ons_subscription" "test_subscription" {
  compartment_id = "${var.compartment_OCID}"
  endpoint       = "${var.function_OCID}"
  protocol       = "${var.subscription_protocol}"
  topic_id       = "${oci_ons_notification_topic.test_notification_topic.id}"

  defined_tags  = "${map("${oci_identity_tag_namespace.tag_namespace1.name}.${oci_identity_tag.tag1.name}", "${var.subscription_defined_tags_value}")}"
  freeform_tags = "${var.subscription_freeform_tags}"

data "oci_ons_subscriptions" "test_subscriptions" {
  compartment_id = "${var.compartment_ocid}"

  topic_id = "${oci_ons_subscription.test_subscription.topic_id}"

You can find the complete set of Notifications service Terraform examples on GitHub.


Create a function subscription:

POST /20181201/subscriptions
Host: notification.<oracle-cloud-infrastructure-region>.oraclecloud.com
<authorization and other headers>

  "topicId": "<topic_OCID>",
  "compartmentId": "<compartment_OCID>",
  "protocol": "ORACLE_FUNCTIONS",
  "endpoint": "<function_OCID>"


There’s no additional charge to trigger a function from the Notifications service. Function rates are provided on the Oracle Functions product page.

More Information

For more information about this feature and the Notifications service, see the following resources:

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha