Trigger with events

You can create an Eventarc trigger so that your Cloud Run service receives notifications of a specified event or set of events. By specifying filters for the trigger, you can configure the routing of the event, including the event source and the target Cloud Run service.

Events sent to your Cloud Run service are received in the form of HTTP requests.

The following event types trigger requests to your service:

This page shows you how to create a trigger through the Cloud Run console page.

You can also create an Eventarc trigger using the Google Cloud CLI or through the Eventarc console page. Follow the instructions to create a trigger for a specific provider, event type, and destination.

Prepare to create a trigger

Before you create a trigger, complete these prerequisites:

  1. Every Eventarc trigger is associated with an Identity and Access Management (IAM) service account at the time the trigger is created. You can specify a user-managed service account that the trigger uses as its default identity. Ensure that you grant the required roles and permissions to the trigger's service account.

    For example, to send events to a Cloud Run service that requires authentication, the service account for the Eventarc trigger must have the Cloud Run Invoker IAM role.

  2. If you are creating a trigger for a direct event from Cloud Storage, grant the pubsub.publisher role to the Cloud Storage service account:

    SERVICE_ACCOUNT="$(gsutil kms serviceaccount -p PROJECT_ID)"
    gcloud projects add-iam-policy-binding PROJECT_ID \
        --member="serviceAccount:${SERVICE_ACCOUNT}" \

    Replace PROJECT_ID with your Google Cloud project ID. You can find your project ID on the Welcome page of the Google Cloud console.

Create a trigger through the console

You can use the Cloud Run console page to create an Eventarc trigger.

  1. If necessary, enable the Eventarc API.

    Enable the API

  2. In the Google Cloud console, go to Cloud Run.

    Go to Cloud Run

  3. From the list of services, click an existing service, or create a new service.

  4. On the Service details page, click the Triggers tab.

  5. Click Add Eventarc trigger.

    The Eventarc trigger pane opens. To determine how best to route events, see Event routing options.

  6. Follow the instructions to create a trigger for a specific provider, event type, and destination and refer to the Console instructions in the "Create a trigger" section.

  7. Select the Service account that invokes your Cloud Run service.

    Or, create a new service account.

    This specifies the IAM service account email associated with the trigger. For Cloud Run destinations, this service account is used to generate identity tokens when invoking the service.

  8. Optionally, specify the Service URL path to send the incoming request to.

    This is the relative path on the destination service to which the events for the trigger should be sent. For example: /, /route, route, route/subroute.

  9. After creating the trigger, verify its health by ensuring that there is a checkmark on the Triggers tab.

What's next