Three ways of receiving events in Cloud Run

What’s new with Google Cloud
March 11, 2021
The Good, the Bad and the Ugly in Cybersecurity – Week 11
March 12, 2021
What’s new with Google Cloud
March 11, 2021
The Good, the Bad and the Ugly in Cybersecurity – Week 11
March 12, 2021

The reasoning behind the decision framework boils down to answering these questions:

  1. Does the Google Cloud service or application support Audit Logs, Pub/Sub, or both?
  2. When both Audit Logs and Pub/Sub are supported, does the Audit Log entry have more or different info than the Pub/Sub message or vice versa?
  3. In the Pub/Sub case, do you care about standardizing on Eventarc and CloudEvents format and the convenience of not having to create Pub/Sub topics and subscriptions?

Let’s explore these questions with some concrete scenarios.

In the custom application scenario, there are no Audit Logs because it’s not a Google Cloud service, so you only need to consider Pub/Sub options. The question then becomes whether you want to get Pub/Sub messages directly or via Eventarc. Pub/Sub is probably the more familiar route whereas Eventarc provides a standard way of receiving events from multiple sources and a standard CloudEvent format. This is useful if you intend to read from multiple event sources and not just from Pub/Sub.

If you want to read events from a Google Cloud service that supports only Audit Logs, then your only option is Eventarc.

It becomes more interesting when a Google Cloud service supports both Audit Logs and Pub/Sub (e.g., Cloud Build, Cloud Storage). In these cases, the type/content of Audit Logs and Pub/Sub messages should drive your choice.

For example, Cloud Storage can generate Audit Logs and it can also send a message to a Pub/Sub topic when a new object is created. The contents (bucket name, object name) and latency of both are roughly the same, so you can choose either.

Cloud Build can also generate both Audit Logs and Pub/Sub messages but the Pub/Sub based build notifications have build status (success, failure) whereas Audit Logs of Cloud Build mainly provide info about admin operations such as build creation and deletion. If build status is important, it makes sense to choose Pub/Sub over Audit Logs.

In both Cloud Storage and Cloud Build, if you go with Pub/Sub, you still need to decide whether you’ll read them with or without Eventarc. As already explained in the custom application scenario, this is a choice between a familiar setup with Pub/Sub vs. convenience and standardization that comes with Eventarc and CloudEvents.

I should note that Eventarc aims to improve upon its event sources and contents of events in future iterations. You should expect to see richer events beyond what Audit Logs provide today.

As always, feel free to reach out to me on Twitter @meteatamel for any questions or feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *