Events and Triggers

This page describes the concept of events in the context of Google Cloud Functions. It also covers how to create and associate triggers with functions so that they will execute when an event is fired. Finally, this page describes the schema for the most common event types.


Cloud events are things that happen within your cloud environment that you might want to take action on. These might be things like changes to data in a database, files added to a storage system, or a new virtual machine instance being created. Currently, Cloud Functions supports events from the following providers:

For examples of how to associate triggers with functions so that they will execute when an event is fired, see the tutorials.

Event Parameter and Data Property

The event parameter holds the data associated with the event that triggered the execution of the function along with metadata about the event itself. The table below describes the fields contained in the event parameter.

Property Description Type
eventId A unique ID for the event. String
timestamp The date/time this event was created. String (ISO 8601)
eventType The type of the event. String
resource The resource that emitted the event. String
data The event data. Object

The actual data is contained in the property. Each event type has its own schema for the data property. Below is a list of current event types and their data payloads:


Creating a response to an event is done with a Trigger. A trigger is a declaration that you are interested in a certain event or set of events. Binding a function to a trigger allows you to capture and act on events.

Below is a table of the types of triggers supported and the flags used to specify them during command line deployment:

Resource Event type Command line flag
HTTP Request --trigger-http
Google Cloud Storage Object change notification --trigger-bucket [BUCKET NAME]
Google Cloud Pub/Sub PubSubMessage --trigger-topic [TOPIC NAME]

Binding of triggers to functions happens at deployment time either via the CLI, the UI or Cloud Functions API. Functions and triggers are bound to each other on a many-to-one basis. In other words, you cannot bind the same function to more than a single trigger at a time. You can, however, have the same trigger cause multiple functions to execute by simply deploying two different functions with the same trigger.

Send feedback about...

Cloud Functions Documentation