함수가 호출되거나 트리거되는 방식은 코드를 작성할 때 지정하는 함수 유형에 따라 다릅니다.
이벤트 기반 트리거: Google Cloud 프로젝트 내 이벤트에 반응하며 이벤트 기반 함수(CloudEvent 함수라고도 함)에 대응합니다. 지정된 이벤트에 대한 응답으로 함수를 트리거하려면 이벤트 기반 아키텍처 빌드를 지원하는 CloudEvents 사양의 Google 구현인 Eventarc를 사용해야 합니다.
HTTP 트리거: HTTP(S) 요청에 반응하고 HTTP 함수에 대응합니다. 다른Google Cloud 서비스(Eventarc가 아님)를 이벤트 제공업체로 사용하여 HTTP(S) 요청을 통해 함수를 호출할 수 있습니다.
함수가 Google Cloud 프로젝트 내 이벤트에 반응하도록 트리거하려면 Google Cloud 콘솔에서 함수 배포 과정의 일부로 또는 gcloud CLI를 사용할 경우 함수가 배포된 후에 트리거를 지정합니다.
같은 함수를 한 번에 트리거 두 개 이상에 바인딩할 수는 없지만 같은 트리거 설정으로 함수 여러 개를 배포하면 같은 이벤트로 인해 함수 여러 개가 실행될 수 있습니다.
Pub/Sub 메시지는 HTTP 요청을 통해 직접 함수로 라우팅되거나 Eventarc에서 이벤트 기반 트리거로 래핑될 수 있습니다.
모든 이벤트 기반 함수는 이벤트 전송에 Eventarc를 사용합니다.
Pub/Sub 트리거 및 Cloud Storage 트리거는 특정 유형의 Eventarc 트리거로 구현됩니다.
Pub/Sub 및 웹훅을 사용하는 추가 트리거
Pub/Sub 주제의 메시지로 Cloud Run Functions를 트리거할 수 있으므로 Pub/Sub을 이벤트 버스로 지원하는 다른 Google 서비스와 Cloud Run Functions를 통합할 수 있습니다. 또한 HTTP 트리거를 사용하여 HTTP 콜백(웹훅)을 제공하는 모든 서비스와 통합할 수 있습니다. 다음 섹션에서는 몇 가지 통합 예시를 설명합니다.
Cloud Logging
Cloud Logging은 로그를 Pub/Sub 주제로 라우팅할 수 있으며, 여기서 Cloud Run Functions에서 로그를 사용할 수 있습니다. 자세한 내용은 Cloud Logging 문서의 싱크 구성 및 관리를 참조하세요.
Cloud Scheduler
HTTP를 사용하여 작업을 트리거하는 Cloud Scheduler 작업을 만들어 HTTP 함수를 예약할 수 있습니다.
메시지가 Pub/Sub 주제에 게시되는 경우와 같이 Google Cloud 프로젝트 내에서 이벤트에 대한 응답으로 함수를 직접 트리거해야 하는 경우에도 이벤트 기반 함수를 예약할 수 있습니다.
Cloud Tasks
Cloud Tasks HTTP 대상 태스크를 사용하면 모든 HTTP 엔드포인트에서 태스크 핸들러를 실행할 수 있으므로 HTTP 트리거가 있는 HTTP 함수를 태스크 핸들러로 사용할 수 있습니다. 태스크를 사용하여 함수 호출을 제한하거나 호출 비율을 제한할 수도 있습니다.
자세한 내용은 Cloud Tasks 문서의 HTTP 대상 태스크 만들기를 참조하세요.
Gmail
Gmail Push Notification API를 사용하여 Gmail 이벤트를 Pub/Sub 주제로 전송하여 Cloud Run에서 사용할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Cloud Run function triggers\n\nAfter you [create and deploy your Cloud Run function](/run/docs/deploy-functions),\nyou can set your function to execute in response to various scenarios by\nspecifying a trigger. This page provides an overview of the triggers supported\nby Cloud Run functions.\n\nTypes of triggers\n-----------------\n\nBy default, all functions deployed on Cloud Run are\n[Cloud Run source-deployed services](/run/docs/resource-model#source)\nthat have an HTTP endpoint (`run.app` URL). If you previously created a function\nwith the [`gcloud functions` command](/functions/docs/deploy) or the\n[Cloud Functions v2 API](/functions/docs/apis), by default, the function\nhas a `cloudfunctions.net` HTTP endpoint.\n\nHow your function is invoked or triggered depends on the type of function you\nspecify when [writing your code](/run/docs/write-functions#signature_type).\n\n- **Event-driven triggers** : Reacts to events within your Google Cloud project and corresponds to [event-driven functions](/run/docs/write-event-driven-functions) (also called *CloudEvent functions*). You must use Eventarc, Google's implementation of the CloudEvents spec that supports building event-driven architectures, to trigger functions in response to specified events.\n- **HTTP triggers** : Reacts to HTTP(S) requests and correspond to [HTTP functions](/run/docs/write-http-functions). You can use other Google Cloud services (non-Eventarc) as an event provider to invoke the function through HTTP(S) requests.\n\nTo trigger a function to react to events within your Google Cloud project,\nyou specify triggers as part of deploying the function in the Google Cloud console\nor after function is deployed when using the gcloud CLI.\n\nYou cannot bind the same function to more than one trigger at a time, but you\ncan have the same event cause multiple functions to execute by deploying\nmultiple functions with the same trigger settings.\n| **Note:** Trigger binding does not happen instantaneously. It may take several minutes for a deployed function to start triggering on incoming events.\n\nExample triggers\n----------------\n\nThe following are example triggers supported by\nCloud Run functions:\n\n- Event-driven triggers:\n\n - [Pub/Sub events triggered by Eventarc](/run/docs/triggering/pubsub-triggers)\n - [Cloud Storage events triggered by Eventarc](/run/docs/triggering/storage-triggers)\n - [Firestore events triggered by Eventarc](/run/docs/triggering/firestore-triggers)\n - [Other event triggers](/run/docs/triggering/trigger-with-events)\n - Supports any [event type supported by Eventarc](/eventarc/docs/reference/supported-events), including 90+ event sources using Cloud Audit Logs\n- HTTP triggers:\n\n - [Invoke with an HTTP request](/run/docs/triggering/https-request)\n - [Invoke services as part of a workflow with Workflows](/run/docs/triggering/invoke-services-from-workflows)\n - [Invoke services on a schedule with Cloud Scheduler](/run/docs/triggering/using-scheduler)\n - [Use Cloud Tasks to execute asynchronous tasks](/run/docs/triggering/using-tasks)\n - [Trigger services from a Pub/Sub push subscription](/run/docs/tutorials/pubsub)\n - Pub/Sub messages can be routed directly to a function through HTTP requests or wrapped under Eventarc as an event-driven trigger.\n\nAll event-driven functions use Eventarc for event delivery.\nPub/Sub triggers and Cloud Storage triggers are implemented as\nparticular types of Eventarc triggers.\n| **Note:** Eventarc does not support direct events from Google Analytics for Firebase, or Firebase Authentication.\n\nAdditional triggers using Pub/Sub and webhooks\n----------------------------------------------\n\nBecause Cloud Run functions can be triggered by messages on a\nPub/Sub topic, you can integrate Cloud Run functions with any\nother Google service that supports Pub/Sub as an event bus. In addition,\nby using HTTP triggers you can also integrate with any service that provides\nHTTP callbacks (webhooks). The following sections describe some example\nintegrations.\n\n### Cloud Logging\n\nCloud Logging can route logs to a Pub/Sub topic, where they can then\nbe consumed by Cloud Run functions. See\n[Configure and manage sinks](/logging/docs/export/configure_export_v2) in the\nCloud Logging documentation for more information.\n\n### Cloud Scheduler\n\nYou can schedule an HTTP function by creating a Cloud Scheduler job\nthat triggers an action using HTTP.\n\nYou can also schedule an event-driven function when your function should be triggered\ndirectly in response to events within your Google Cloud project; for example, when a\nmessage is published to a Pub/Sub topic.\n\n### Cloud Tasks\n\nCloud Tasks HTTP Target tasks enable you to run task handlers at any\nHTTP endpoint, so an HTTP function with an HTTP trigger can be used as a task\nhandler. You can also use tasks to throttle or rate-limit function invocations.\nSee [Create HTTP Target tasks](/tasks/docs/creating-http-target-tasks) in the\nCloud Tasks documentation for more information.\n\n### Gmail\n\nUsing the Gmail\n[Push Notification API](https://developers.google.com/gmail/api/guides/push),\nyou can send Gmail events to a Pub/Sub topic and consume them\nwith Cloud Run."]]