Create an Eventarc trigger

This pageapplies toApigee andApigee hybrid.

API hub supportsEventarc triggers. Byusing this feature, you can trigger executions based on the events occurring in API hub. Forexample, you can execute aCloud Run service whenan API is created in API hub.

This quickstart shows you how to create and configure an Eventarc trigger that executes a Cloud Run service when an API is updated in API hub.

Before you begin

  1. API hub must be provisioned in a Google Cloud project to which you have access. SeeProvision API hub.
  2. In the Google Cloud console, on the project selector page, select the project in which API hub is provisioned.

    Go to project selector
  3. You must have a valid Cloud Run service running. You will use the Cloud Run service details when configuring the Eventarc trigger. This is the service that will be executed when the configured event occurs.

Create an Eventarc trigger

  1. In the Google Cloud console, go to the EventarcTriggers page.

    Go to Triggers

  2. ClickCreate trigger.
  3. Enter aTrigger name. For example,cloudrun-trigger-1.
  4. In theTrigger type list, selectGoogle sources.

    This filters events sent from Google Cloud providers (directly or through Cloud Audit Logs entries), or providers using Pub/Sub messages.

  5. In theEvent provider list, selectAPI hub.
  6. In theEvent type list, selectgoogle.cloud.apihub.v1.updated.
  7. In theEvent content data type list, select eitherJSON orProtobuf.
  8. Select aRegion.
  9. Optionally,Add filters to select the APIs that match your criteria. For example, if youfilter the APIs by a specific name, the event is triggered only if the APIs matching the filtercriteria are updated.
  10. If prompted, grant the following:
    • iam.serviceAccountTokenCreator role to Pub/Sub service account
    • pubsub.publisher role to Cloud Storage service account
  11. Use theDefault compute service account as the service account that invokes your service.
  12. In theEvent destination list, selectCloud Run.
  13. Select a Cloud Run service that should be executed when thegoogle.cloud.apihub.v1.updated event occurs in API hub.
  14. Optionally, enter theService URL path.
  15. ClickCreate.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.