Bitzu

Associate Cloud Engineer ยท Containers and serverless deployments

Event-driven serverless with Eventarc

Triggering serverless code from Pub/Sub messages, Cloud Storage object events and other sources via Eventarc, CloudEvents format, trigger vs push subscription.

Key points

  • Eventarc triggers deliver events as CloudEvents to targets such as Cloud Run.
  • Create one with gcloud eventarc triggers create, choosing --event-filters type=..., a --location and a destination (--destination-run-service).
  • Common types: google.cloud.pubsub.topic.v1.messagePublished and google.cloud.storage.object.v1.finalized.
  • A Pub/Sub push subscription is the lower-level alternative that POSTs messages to an HTTPS endpoint.

Source: https://docs.cloud.google.com/eventarc/docs/reference/supported-events

Practice questions

Single choice

Which Eventarc event type fires when a message is published to a Pub/Sub topic?

  1. google.cloud.pubsub.topic.v1.messagePublished
  2. google.cloud.storage.object.v1.finalized
  3. google.cloud.run.service.v1.created
  4. google.cloud.pubsub.topic.v1.created
Show answer

Answer: A. google.cloud.pubsub.topic.v1.messagePublished

google.cloud.pubsub.topic.v1.messagePublished is the Pub/Sub event type. The storage types concern bucket objects.

Select all that apply

Which flags are part of creating an Eventarc trigger that targets a Cloud Run service?

  1. --event-filters
  2. --location
  3. --destination-run-service
  4. --image
  5. --runtime
Show answer

Answer: A. --event-filters, B. --location, C. --destination-run-service

--event-filters selects events, --location sets where the trigger lives, and --destination-run-service names the target. --image and --runtime belong to deploy commands.

True or false

True or false: Eventarc can only react to Pub/Sub messages and cannot react to Cloud Storage object events.

Show answer

Answer: False

False. Eventarc supports Cloud Storage direct events such as object finalized, in addition to Pub/Sub and other sources.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Associate Cloud Engineer topics in this module