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
Which Eventarc event type fires when a message is published to a Pub/Sub topic?
- google.cloud.pubsub.topic.v1.messagePublished
- google.cloud.storage.object.v1.finalized
- google.cloud.run.service.v1.created
- 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.
Which flags are part of creating an Eventarc trigger that targets a Cloud Run service?
- --event-filters
- --location
- --destination-run-service
- --image
- --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: 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.
