Setiap sumber peristiwa, target peristiwa, dan pemicu Eventarc memiliki
lokasinya sendiri. Terkadang, lokasi ini harus sama; terkadang, lokasi ini bisa berbeda. Untuk mengetahui informasi selengkapnya, lihat Lokasi Eventarc.
Lokasi sumber
Lokasi sumber peristiwa sering kali menentukan lokasi pemicu. Dalam
contoh berikut, karena bucket Cloud Storage berada di region europe-west1, pemicu juga harus berada di europe-west1.
Saat men-deploy target peristiwa (misalnya, layanan Cloud Run),
Anda memilih region yang didukung sebagai lokasinya. Biasanya, untuk alasan latensi dan lokalitas data, Anda ingin agar ini berada di region yang sama dengan sumber peristiwa Anda.
Namun, hal ini bukan persyaratan dan dalam contoh sebelumnya, sumber peristiwa
berada di europe-west1, sementara tanda --destination-run-region menunjukkan bahwa
target peristiwa berada di us-central1.
Lokasi pemicu
Selain itu, jenis pemicu Eventarc yang Anda buat memengaruhi
lokasi pemicu yang ditentukan melalui tanda --location:
Cloud Audit Logs
Dengan pemicu Cloud Audit Logs, Anda dapat menghubungkan sumber peristiwa apa pun yang memancarkan log audit ke target peristiwa. Pemicu Cloud Audit Logs tersedia di lokasi satu region dan Anda juga dapat membuat pemicu Eventarc global; namun, pemicu tidak didukung di lokasi dual-region dan multi-region.
Lokasi sumber peristiwa menentukan lokasi pemicu. Biasanya,
ini adalah lokasi satu wilayah. Misalnya, untuk merekam peristiwa Cloud Storage dari bucket di region europe-west1 dengan pemicu audit log, buat pemicu di lokasi yang sama:
Karena tidak ada pemfilteran menurut bucket saat Anda menggunakan pemicu Cloud Audit Logs, pemicu ini akan cocok dengan semua bucket di region europe-west1. (Untuk memfilter
menurut bucket, Anda dapat menggunakan pemicu Cloud Storage langsung.)
Atau, untuk mencocokkan bucket dual-region atau multi-region seperti eu, Anda dapat membuat pemicu dengan lokasi global dan ini akan mencocokkan semua bucket di semua region yang filter peristiwanya cocok:
Pemicu Cloud Storage merespons peristiwa di dalam bucket Cloud Storage—pembuatan, penghapusan, pengarsipan, dan pembaruan metadata objek.
Pemicu Cloud Storage tersedia di lokasi satu region, dual-region, dan multi-region; Anda tidak dapat membuat pemicu Eventarc global.
Lokasi bucket Cloud Storage menentukan lokasi
pemicu Eventarc, dan keduanya harus cocok. Dalam contoh berikut, lokasi pemicu cocok dengan lokasi bucket Cloud Storage (lokasi multi-region eu):
Pemicu Pub/Sub menghubungkan topik Pub/Sub ke target peristiwa. Pemicu Pub/Sub hanya tersedia di lokasi satu region dan Anda tidak dapat membuat pemicu Eventarc global.
Meskipun topik Pub/Sub bersifat global dan tidak terikat ke satu region, saat membuat pemicu Pub/Sub, Anda harus menentukan region untuk pemicu tersebut menggunakan tanda --location:
Eventarc mengonfigurasi geofencing sehingga peristiwa Pub/Sub hanya tetap ada di lokasi yang ditentukan. Anda juga dapat menggunakan endpoint layanan Pub/Sub regional untuk memublikasikan ke topik sehingga semua data tetap berada dalam satu region.
Langkah berikutnya
Untuk mempelajari cara merutekan peristiwa di seluruh Google Cloud project, lihat tutorial.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[[["\u003cp\u003eEvent source and trigger locations often need to match, such as with Cloud Storage where the bucket's region dictates the trigger's location.\u003c/p\u003e\n"],["\u003cp\u003eWhile the event target's region is typically chosen for latency and data locality, it doesn't necessarily have to be the same as the event source's region.\u003c/p\u003e\n"],["\u003cp\u003eCloud Audit Logs triggers can be created in single-region locations or globally, allowing connections to various event sources that emit audit logs.\u003c/p\u003e\n"],["\u003cp\u003eCloud Storage triggers require the trigger location to precisely match the Cloud Storage bucket's location, and they support single, dual, and multi-region locations, but not globally.\u003c/p\u003e\n"],["\u003cp\u003ePub/Sub triggers, although linked to globally accessible topics, are only available in single-region locations, and data can be confined to a single region using geofencing.\u003c/p\u003e\n"]]],[],null,["# Understand Eventarc locations\n\n[Standard](/eventarc/standard/docs/overview)\n\nEach event source, event target, and Eventarc trigger has its own\nlocation. Sometimes, these locations must match; at other times, they can be\ndifferent. For more information, see [Eventarc locations](/eventarc/docs/locations).\n\n### Source location\n\nThe location of the event source often dictates the trigger location. In the\nfollowing example, since the Cloud Storage bucket is in the `europe-west1`\nregion, the trigger must also be located in `europe-west1`. \n\n gcloud eventarc triggers create trigger-storage \\\n --destination-run-service=hello \\\n --destination-run-region=us-central1 \\\n --location=europe-west1 \\\n --event-filters=\"type=google.cloud.storage.object.v1.finalized\" \\\n --event-filters=\"bucket=my-bucket-in-europe-west1-region\" \\\n --service-account=$PROJECT_NUMBER-compute@developer.gserviceaccount.com\n\n### Target location\n\nWhen deploying your event target (for example, a Cloud Run service),\nyou choose a supported region as its location. Typically, for latency and data\nlocality reasons, you want this to be in the same region as your event source.\nHowever, it is not a requirement and in the preceding example, the event source\nis in `europe-west1` while the `--destination-run-region` flag indicates that\nthe event target is in `us-central1`.\n\n### Trigger location\n\nAdditionally, the type of Eventarc trigger you create impacts the\nlocation of the trigger which is specified through the `--location` flag: \n\n### Cloud Audit Logs\n\nUsing Cloud Audit Logs triggers, you can connect any event source that\nemits audit logs to an event target. Cloud Audit Logs triggers are\navailable in single-region locations and you can also create a global\nEventarc trigger; however, triggers are not supported in\ndual-region and multi-region locations.\n\nThe location of the event source dictates the trigger location. Typically,\nthis is a single-region location. For example, to capture Cloud Storage\nevents from a bucket in the `europe-west1` region with an audit logs trigger,\ncreate a trigger in the same location: \n\n gcloud eventarc triggers create trigger-auditlog \\\n --destination-run-service=hello \\\n --destination-run-region=us-central1 \\\n --location=europe-west1 \\\n --event-filters=\"type=google.cloud.audit.log.v1.written\" \\\n --event-filters=\"serviceName=storage.googleapis.com\" \\\n --event-filters=\"methodName=storage.objects.create\" \\\n --service-account=$PROJECT_NUMBER-compute@developer.gserviceaccount.com\n\nAs there's no filtering by bucket when you use a Cloud Audit Logs\ntrigger, this will match all buckets in the `europe-west1` region. (To filter\nby bucket, you can instead use a direct Cloud Storage trigger.)\n\nOr, to match a dual-region or multi-region bucket such as `eu`, you can\ncreate a trigger with a `global` location and this will match all buckets in\nall regions for which the event filters match: \n\n gcloud eventarc triggers create trigger-storage \\\n --destination-run-service=hello \\\n --destination-run-region=us-central1 \\\n --location=global \\\n --event-filters=\"type=google.cloud.storage.object.v1.finalized\" \\\n --event-filters=\"bucket=my-bucket-in-europe-west1-region\" \\\n --service-account=$PROJECT_NUMBER-compute@developer.gserviceaccount.com\n\n| **Note:** There is a known issue with Cloud Audit Logs triggers for [Compute Engine](/eventarc/docs/reference/supported-events#compute-engine) that results in events originating from a single region: `us-central1`. This is regardless of where the virtual machine instance is actually located. When [creating your trigger for a specific provider and destination](/eventarc/standard/docs/event-providers-targets#triggers), set the trigger location to either `us-central1` or `global`.\n\n### Cloud Storage\n\nCloud Storage triggers respond to events inside a Cloud Storage\nbucket---object creation, deletion, archiving, and metadata updates.\nCloud Storage triggers are available in single-region, dual-region,\nand multi-region locations; you cannot create a global Eventarc\ntrigger.\n\nThe location of the Cloud Storage bucket dictates the location of\nthe Eventarc trigger, and they *must* match. In the following\nexample, the trigger location matches that of the Cloud Storage\nbucket (the `eu` multi-region location): \n\n gcloud eventarc triggers create trigger-storage \\\n --destination-run-service=hello \\\n --destination-run-region=us-central1 \\\n --location=eu \\\n --event-filters=\"type=google.cloud.storage.object.v1.finalized\" \\\n --event-filters=\"bucket=my-bucket-in-eu-multi-region\" \\\n --service-account=$PROJECT_NUMBER-compute@developer.gserviceaccount.com\n\nIf the bucket and trigger regions don't match, you will see an error similar\nto the following: \n\n ERROR: (gcloud.eventarc.triggers.create) INVALID_ARGUMENT: The request was\n invalid: Bucket \"my-bucket-in-eu-multi-region\" location \"eu\" does not match\n trigger location \"europe-west1\". Try again by creating the trigger in \"eu\".\n\n### Pub/Sub\n\nA Pub/Sub trigger connects a Pub/Sub topic to\nan event target. Pub/Sub triggers are only available in\nsingle-region locations and you cannot create a global Eventarc\ntrigger.\n\nAlthough Pub/Sub topics are global and not tied to a\nsingle region, when you create a Pub/Sub trigger, you\nmust specify a region for it using the `--location` flag: \n\n gcloud eventarc triggers create trigger-pubsub \\\n --destination-run-service=hello \\\n --destination-run-region=us-central1 \\\n --location=us-central1 \\\n --event-filters=\"type=google.cloud.pubsub.topic.v1.messagePublished\" \\\n --transport-topic=projects/your-projectid/topics/your-topic\n\nEventarc configures geofencing so that Pub/Sub\nevents persist only in the specified location. You can also use regional\n[Pub/Sub service endpoints](/pubsub/docs/reference/service_apis_overview#service_endpoints)\nto publish to the topic so that all of the data stays in a single region.\n\nWhat's next\n-----------\n\n- To learn how to route events across Google Cloud projects, see the [tutorial](/eventarc/docs/cross-project-triggers)."]]