Bird
Raised Fist0
GCPcloud~20 mins

Eventarc for event routing in GCP - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Eventarc Routing Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does Eventarc route events in Google Cloud?

Which statement best describes how Eventarc routes events to targets?

AEventarc stores all events in a database before sending them to targets in batches every hour.
BEventarc listens for events from sources and forwards them to specified Cloud Run services or other targets based on filters.
CEventarc requires manual polling of event sources to retrieve events and then pushes them to targets.
DEventarc only routes events between Compute Engine instances using internal IP addresses.
Attempts:
2 left
💡 Hint

Think about how Eventarc connects event sources to services automatically.

❓ Architecture
intermediate
2:00remaining
Eventarc architecture for multi-region event delivery

You want to design an Eventarc setup that delivers events from multiple regions to a single Cloud Run service in us-central1. Which architecture ensures low latency and reliability?

ACreate Eventarc triggers in each source region forwarding events directly to the Cloud Run service in us-central1.
BUse a single Eventarc trigger in us-central1 that pulls events from all regions using a global event bus.
CDeploy Cloud Run services in each region and use Eventarc triggers to route events locally, then forward results to us-central1 manually.
DConfigure Eventarc to replicate events to Pub/Sub topics in us-central1, then trigger Cloud Run from those topics.
Attempts:
2 left
💡 Hint

Consider how Eventarc triggers work regionally and how direct routing affects latency.

❓ security
advanced
2:00remaining
Securing Eventarc triggers with least privilege

You want to ensure Eventarc triggers have the minimum permissions needed to deliver events to a Cloud Run service. Which IAM role should you assign to the Eventarc service account?

Aroles/eventarc.admin on the Cloud Run service
Broles/owner on the Cloud Run service
Croles/editor on the entire project
Droles/run.invoker on the Cloud Run service
Attempts:
2 left
💡 Hint

Think about the permission needed to invoke a Cloud Run service securely.

❓ service_behavior
advanced
2:00remaining
Eventarc trigger filter behavior

Given an Eventarc trigger with the filter type=google.cloud.storage.object.v1.finalized, what happens when a new object is created in a Cloud Storage bucket?

AThe trigger activates and routes the event to its target because the event type matches the filter.
BThe trigger ignores the event because it only listens for deletion events.
CThe trigger activates but fails to route the event because the filter syntax is incorrect.
DThe trigger routes all events from Cloud Storage regardless of type.
Attempts:
2 left
💡 Hint

Consider what the event type finalized means in Cloud Storage.

✅ Best Practice
expert
2:00remaining
Optimizing Eventarc for high event volume

You expect a very high volume of events from multiple sources routed to a Cloud Run service via Eventarc. Which approach best optimizes performance and cost?

ADisable Eventarc and poll event sources manually to control event flow.
BUse a single Eventarc trigger with broad filters sending all events to one Cloud Run service instance.
CUse multiple Eventarc triggers with specific filters to route subsets of events to separate Cloud Run services for parallel processing.
DRoute all events to a single Pub/Sub topic and have Cloud Run subscribe directly without Eventarc.
Attempts:
2 left
💡 Hint

Think about splitting workload to avoid bottlenecks and reduce costs.

Practice

(1/5)
1. What is the main purpose of Eventarc in Google Cloud?
easy
A. To create virtual machines for running applications
B. To store large amounts of data in the cloud
C. To route events from cloud services to your applications automatically
D. To manage user permissions and roles

Solution

  1. Step 1: Understand Eventarc's role

    Eventarc is designed to listen for events from various cloud services and route them to your applications automatically.
  2. Step 2: Compare options

    Options A, B, and D describe other cloud services like storage, compute, and IAM, which are not Eventarc's purpose.
  3. Final Answer:

    To route events from cloud services to your applications automatically -> Option C
  4. Quick Check:

    Event routing = To route events from cloud services to your applications automatically [OK]
Hint: Eventarc = automatic event routing to apps [OK]
Common Mistakes:
  • Confusing Eventarc with storage services
  • Thinking Eventarc manages virtual machines
  • Mixing Eventarc with user permission management
2. Which of the following is the correct way to create an Eventarc trigger using gcloud CLI?
easy
A. gcloud compute instances create my-trigger --zone=us-central1-a
B. gcloud eventarc triggers create my-trigger --destination-run-service=my-service --event-filters=type=google.cloud.pubsub.topic.v1.messagePublished
C. gcloud storage buckets create my-trigger --location=us-central1
D. gcloud iam roles create my-trigger --project=my-project

Solution

  1. Step 1: Identify Eventarc trigger creation syntax

    The correct command uses 'gcloud eventarc triggers create' with destination and event filters.
  2. Step 2: Eliminate unrelated commands

    Options B, C, and D relate to compute, storage, and IAM, not Eventarc triggers.
  3. Final Answer:

    gcloud eventarc triggers create my-trigger --destination-run-service=my-service --event-filters=type=google.cloud.pubsub.topic.v1.messagePublished -> Option B
  4. Quick Check:

    Eventarc trigger creation uses 'gcloud eventarc triggers create' [OK]
Hint: Eventarc triggers start with 'gcloud eventarc triggers create' [OK]
Common Mistakes:
  • Using compute or storage commands instead of eventarc
  • Missing event-filters parameter
  • Incorrect destination flag
3. Given this Eventarc trigger configuration snippet:
{
  "name": "projects/my-project/locations/us-central1/triggers/my-trigger",
  "destination": {
    "cloudRunService": {
      "service": "my-service",
      "region": "us-central1"
    }
  },
  "eventFilters": [
    {"attribute": "type", "value": "google.cloud.storage.object.v1.finalized"}
  ]
}

What event will this trigger listen for?
medium
A. New objects finalized (created) in Cloud Storage buckets
B. Messages published to Pub/Sub topics
C. Compute Engine instance start events
D. Cloud SQL database updates

Solution

  1. Step 1: Analyze eventFilters attribute

    The filter type is 'google.cloud.storage.object.v1.finalized', which means when a Cloud Storage object is finalized (created or overwritten).
  2. Step 2: Match event type to options

    This corresponds to new or updated objects in Cloud Storage buckets, not Pub/Sub, Compute Engine, or Cloud SQL events.
  3. Final Answer:

    New objects finalized (created) in Cloud Storage buckets -> Option A
  4. Quick Check:

    Storage object finalized event = New objects finalized (created) in Cloud Storage buckets [OK]
Hint: Storage object finalized event type ends with '.finalized' [OK]
Common Mistakes:
  • Confusing storage events with Pub/Sub messages
  • Assuming compute or database events
  • Ignoring eventFilters attribute
4. You created an Eventarc trigger but your Cloud Run service is not receiving events. Which of the following is the most likely cause?
medium
A. The trigger was created with the wrong gcloud project set
B. The Cloud Run service is in a different region than the trigger
C. The Cloud Run service has no CPU allocated
D. The trigger's event filter type does not match any events being emitted

Solution

  1. Step 1: Check event filter correctness

    If the event filter type does not match any events, no events will be routed to the service.
  2. Step 2: Consider other options

    While region mismatch or wrong project can cause issues, the most common cause is incorrect event filter type. CPU allocation does not prevent event delivery.
  3. Final Answer:

    The trigger's event filter type does not match any events being emitted -> Option D
  4. Quick Check:

    Event filter mismatch blocks events [OK]
Hint: Check event filter matches actual event types [OK]
Common Mistakes:
  • Ignoring event filter mismatch
  • Assuming CPU allocation affects event routing
  • Not verifying project and region settings
5. You want to build an event-driven app that reacts to both Cloud Storage object creations and Pub/Sub messages using Eventarc. What is the best way to configure triggers?
hard
A. Create two separate Eventarc triggers, one for Cloud Storage events and one for Pub/Sub events, both targeting the same Cloud Run service
B. Create a single Eventarc trigger with multiple event filters for both Cloud Storage and Pub/Sub events
C. Create one trigger for Cloud Storage and configure Pub/Sub to push messages directly to Cloud Run without Eventarc
D. Use Cloud Scheduler to poll both services and send events to Cloud Run

Solution

  1. Step 1: Understand Eventarc trigger event filters

    Each Eventarc trigger supports filtering on one event type. To listen to multiple event types, separate triggers are needed.
  2. Step 2: Evaluate options

    Create a single Eventarc trigger with multiple event filters for both Cloud Storage and Pub/Sub events is invalid because a single trigger cannot filter multiple event types. Create one trigger for Cloud Storage and configure Pub/Sub to push messages directly to Cloud Run without Eventarc bypasses Eventarc for Pub/Sub, losing unified routing. Use Cloud Scheduler to poll both services and send events to Cloud Run is unrelated to Eventarc and less efficient.
  3. Final Answer:

    Create two separate Eventarc triggers, one for Cloud Storage events and one for Pub/Sub events, both targeting the same Cloud Run service -> Option A
  4. Quick Check:

    Multiple event types = multiple triggers [OK]
Hint: Use one trigger per event type for multiple events [OK]
Common Mistakes:
  • Trying to use one trigger for multiple event types
  • Bypassing Eventarc for some events
  • Using polling instead of event routing
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard