Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Konektivitas ke layanan yang dihosting di lingkungan serverless
Halaman ini menjelaskan cara mengonfigurasi Konektor Integrasi untuk terhubung ke layanan yang dihosting di lingkungan serverless seperti Cloud Run di Google Cloud.
Gambar berikut menunjukkan penyiapan konektivitas jaringan pribadi dari Konektor Integrasi ke layanan yang dihosting di lingkungan Cloud Run di Google Cloud:
Halaman ini mengasumsikan bahwa Anda sudah memahami konsep berikut:
Saat Anda membuat lampiran layanan PSC, pertimbangkan poin-poin penting berikut:
Lampiran layanan PSC dan load balancer dibuat di subnet yang berbeda
dalam VPC yang sama. Secara khusus, lampiran layanan selalu dibuat di subnet NAT.
Traffic dari load balancer dan probe health check harus dikirim ke port yang sama.
Konfigurasikan aturan firewall untuk memfasilitasi aliran traffic.
Aturan traffic masuk
Traffic dari subnet lampiran layanan PSC harus menjangkau layanan backend Anda.
Aturan traffic keluar
Traffic keluar diaktifkan secara default di project Google Cloud, kecuali jika aturan penolakan tertentu dikonfigurasi.
Semua komponen Google Cloud Anda seperti lampiran layanan PSC dan load balancer harus berada di region yang sama.
Membuat lampiran layanan PSC
Untuk membuat konektivitas pribadi dari Integration Connectors, layanan Anda harus diekspos ke Integration Connectors menggunakan lampiran layanan PSC. Lampiran layanan selalu menggunakan load balancer. Oleh karena itu, jika layanan Anda tidak berada di balik load balancer, load balancer harus dikonfigurasi.
Buat load balancer. Jika sudah memiliki load balancer, lewati langkah ini.
Dalam perintah ini, LIMIT adalah batas koneksi untuk project. Batas koneksi adalah jumlah endpoint PSC konsumen yang dapat terhubung ke layanan ini. Untuk mendapatkan SERVICE_DIRECTORY_PROJECT_ID, lakukan langkah berikut:
Anda dapat membuat lampiran layanan PSC sehingga hanya menerima permintaan dari project Google Cloud yang ditentukan. Namun, untuk melakukannya,
Anda memerlukan project ID direktori layanan yang terkait dengan project Google Cloud Anda. Untuk mendapatkan project ID direktori layanan, Anda dapat menggunakan
List Connections API seperti yang ditunjukkan dalam contoh
berikut.
Dalam kasus tertentu seperti backend yang mengaktifkan TLS, tujuan mengharuskan Anda menggunakan nama host, bukan IP pribadi, untuk melakukan validasi TLS. Jika DNS pribadi digunakan, bukan alamat IP untuk tujuan host, selain membuat lampiran endpoint sebagai alamat IP, Anda juga harus mengonfigurasi zona terkelola. Untuk petunjuk cara membuat lampiran endpoint sebagai nama host, lihat Membuat lampiran endpoint sebagai nama host.
Kemudian, saat mengonfigurasi koneksi untuk menggunakan lampiran endpoint, Anda dapat memilih lampiran endpoint ini.
Mengonfigurasi koneksi untuk menggunakan lampiran endpoint
Setelah membuat lampiran endpoint, gunakan lampiran endpoint di koneksi Anda. Saat Anda membuat koneksi baru atau memperbarui koneksi yang ada, di bagian Tujuan, pilih Lampiran endpoint sebagai Jenis Tujuan dan pilih lampiran endpoint yang Anda buat dari daftar Lampiran Endpoint.
Jika Anda membuat zona terkelola, pilih Host Address sebagai Destination Type dan gunakan A-record yang Anda buat saat membuat zona terkelola.
Tips pemecahan masalah
Ikuti panduan yang tercantum di bagian ini untuk menghindari masalah umum:
Untuk memverifikasi bahwa lampiran endpoint disiapkan dengan benar dan koneksi PSC dibuat, periksa status koneksi. Untuk informasi selengkapnya, lihat Memverifikasi koneksi lampiran endpoint.
[[["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-09-02 UTC."],[[["\u003cp\u003eIntegration Connectors can be configured to connect to services in serverless environments like Cloud Run through private network connectivity.\u003c/p\u003e\n"],["\u003cp\u003eEstablishing private connectivity requires exposing the service to Integration Connectors using a Private Service Connect (PSC) service attachment, which uses a load balancer.\u003c/p\u003e\n"],["\u003cp\u003eThe PSC service attachment and load balancer must be in the same region but in different subnets within the same VPC, with the service attachment always in a NAT subnet.\u003c/p\u003e\n"],["\u003cp\u003eFirewall rules need configuration to allow ingress traffic from the PSC service attachment's subnet to the backend service, and egress traffic is generally enabled by default.\u003c/p\u003e\n"],["\u003cp\u003eEndpoint attachments, either as IP addresses or hostnames, can be created and used to connect, and in the case of hostnames, managed zones are also necessary.\u003c/p\u003e\n"]]],[],null,["# Connectivity to services hosted in serverless environment\n=========================================================\n\nThis page describes how you can configure Integration Connectors to connect to services hosted in serverless environments such as Cloud Run in Google Cloud.\n\nThe following image shows a private network connectivity setup from Integration Connectors to a service hosted in the Cloud Run environment in Google Cloud:\n\n\nThis page assumes that you are familiar with the following concepts:\n\n- [Endpoint attachments](/integration-connectors/docs/network-connectivity-private#endpoint-attachments)\n- [Managed zones](/dns/docs/zones)\n- [Private Service Connect (PSC)](/vpc/docs/private-service-connect)\n- [Google Cloud load balancer](/load-balancing)\n\n### Considerations\n\nWhen you create a PSC service attachment, consider the following key points:\n\n- The PSC service attachment and the load balancer are created in different subnets within the same VPC. And specifically, the service attachment is always created in a NAT subnet.\n- Traffic from load balancer and health check probe must be sent to the same port.\n- Configure the firewall rules to facilitate the traffic flow. **Ingress rules**\n\n Traffic from the PSC service attachment's subnet must reach your backend service.\n\n\n **Egress rules**\n\n Egress traffic is enabled by default in a Google Cloud project, unless specific\n deny rules are configured.\n- All your Google Cloud components such as the PSC service attachment and the load balancer must be in the same region.\n\n### Create a PSC service attachment\n\nIn order to establish private connectivity from Integration Connectors, your service must be exposed to Integration Connectors using a PSC service attachment. A service attachment always uses a load balancer. Therefore, if your service isn't behind a load balancer, a load balancer needs to be configured.\n| The steps described in this section assume that you already have your backend service installed and configured.\n\n1. Create a load balancer. If you already have a load balancer, skip this step. Create an application load balancer using serverless NEG as the backend by following the instructions at [Set up a regional internal Application Load Balancer with Cloud Run](/load-balancing/docs/l7-internal/setting-up-l7-internal-serverless).\n\n2. Create the service attachment\n 1. Create a subnet for PSC NAT. The following command creates a subnet with the name `psc-nat-subnet1` and the purpose is `PRIVATE_SERVICE_CONNECT`. \n\n ```scdoc\n gcloud compute networks subnets create psc-nat-subnet1 \\\n --network=VPC_NETWORK --range=SUBNET_RANGE_1 \\\n --purpose=PRIVATE_SERVICE_CONNECT\n ```\n 2. Create a firewall rule to allow traffic from the PSC NAT to the load balancer. \n\n ```component-pascal\n gcloud compute network-firewall-policies rules create PRIORITY --firewall-policy FIREWALL_POLICY_NAME_SA \\\n --direction=INGRESS --network=VPC_NETWORK \\\n --action=allow --allow=tcp:BACKEND_SERVER_PORT --src-ip-ranges=SUBNET_RANGE_1\n ```\n 3. Create service attachment with [explicit approval](/vpc/docs/configure-private-service-connect-producer#publish-service-explicit). \n\n ```scdoc\n gcloud compute service-attachments create SERVICE_ATTACHMENT_NAME --producer-forwarding-rule=FORWARDING_RULE_NAME --connection-preference=ACCEPT_MANUAL --consumer-accept-list=SERVICE_DIRECTORY_PROJECT_ID=LIMIT --nat-subnets=psc-nat-subnet1\n ```\n\n In this command, \u003cvar translate=\"no\"\u003eLIMIT\u003c/var\u003e is the connection limit for the project. The connection limit is the number of consumer\n PSC endpoints that can connect to this service. To get the \u003cvar translate=\"no\"\u003eSERVICE_DIRECTORY_PROJECT_ID\u003c/var\u003e, do the following step:\n - You can create the PSC service attachment such that it accepts requests only from the specified Google Cloud projects. However, to do this,\n you need the project ID of the service directory associated with your Google Cloud project. To get the project ID of the service directory, you can use\n the [List Connections API](/integration-connectors/docs/reference/rest/v1/projects.locations.connections/list) as shown in the following\n example.\n\n | **Note:** Before getting the project ID, ensure that at least one connection is present in your project.\n\n ### Syntax\n\n ```json\n curl -X GET \\\n -H \"authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://connectors.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003eCONNECTORS_PROJECT_ID\u003c/var\u003e/locations/-/connections\"\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONNECTORS_PROJECT_ID\u003c/var\u003e: The ID of your Google Cloud project where you created your connection.\n\n ### Example\n\n This example gets the project ID of the service directory for the `connectors-test` Google Cloud project. \n\n ```json\n curl -X GET \\\n -H \"authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://connectors.googleapis.com/v1/projects/connectors-test/locations/-/connections\"\n ```\n\n Running this command on the terminal displays an output similar to the following: \n\n ```json\n .....\n {\n \"connections\": [\n {\n \"name\": \"projects/connectors-test/locations/asia-northeast1/connections/big-query-iam-invalid-sa\",\n \"createTime\": \"2022-10-07T09:02:31.905048520Z\",\n \"updateTime\": \"2022-10-07T09:22:39.993778690Z\",\n \"connectorVersion\": \"projects/connectors-test/locations/global/providers/gcp/connectors/bigquery/versions/1\",\n \"status\": {\n \"state\": \"ACTIVE\"\n },\n \"configVariables\": [\n {\n \"key\": \"project_id\",\n \"stringValue\": \"connectors-test\"\n },\n {\n \"key\": \"dataset_id\",\n \"stringValue\": \"testDataset\"\n }\n ],\n \"authConfig\": {},\n \"serviceAccount\": \"564332356444-compute@developer.gserviceaccount.com\",\n \"serviceDirectory\": \"projects/abcdefghijk-tp/locations/asia-northeast1/namespaces/connectors/services/runtime\",\n \"nodeConfig\": {\n \"minNodeCount\": 2,\n \"maxNodeCount\": 50\n }\n },\n ....\n ```\n\n In the sample output, for the `connectors-test` Google Cloud project, the project ID\n of the service directory is `abcdefghijk-tp`.\n\n### Create an endpoint attachment to consume the PSC service attachment\n\n**Endpoint attachment as an IP address**\n\nFor instructions on how to create an endpoint attachment as an IP address,\nsee [Create an endpoint attachment as an IP address](/integration-connectors/docs/create-endpoint-attachment#create-ep-ipaddr).\n**Endpoint attachment as a hostname**\n\nIn certain cases such as TLS enabled backends, the destination requires you to use\nhostnames instead of private IPs to perform TLS validation. In those cases where a private\nDNS is used instead of an IP address for the host destination, in addition to creating an endpoint\nattachment as an IP address, you must also configure managed zones. For instructions on how to\ncreate an endpoint attachment as a hostname,\nsee [Create an endpoint attachment as a hostname](/integration-connectors/docs/create-endpoint-attachment#create-ep-hostname).\n\nLater, when you configure your connection to use the endpoint attachment, you can select this endpoint attachment.\n\n### Configure a connection to use the endpoint attachment\n\nNow that you have created an endpoint attachment, use the endpoint attachment in your connection. When you create a new connection or update an existing connection, in the Destinations section, select **Endpoint attachment** as the **Destination Type** and select the endpoint attachment that you created from the **Endpoint Attachment** list.\n\nIf you created a managed zone, select **Host Address** as the **Destination Type** and use the A-record that you created while creating the managed zone.\n\nTroubleshooting tips\n--------------------\n\nFollow the guidelines listed in this section to avoid common issues:\n\n- To verify that the endpoint attachment is set up correctly and the PSC connection is established, check the connection status. For more information, see [Verify the endpoint attachment connection](/integration-connectors/docs/create-endpoint-attachment#verify-ep-connection).\n- For information about troubleshooting Load Balancer issues, see [Troubleshoot issues with internal Application Load Balancers](/load-balancing/docs/l7-internal/troubleshooting-l7-ilb).\n- [Google Cloud Connectivity test](/network-intelligence-center/docs/connectivity-tests/concepts/overview) can be used to identify any gaps in your network configuration. For more information, see [Create and run Connectivity Tests](/network-intelligence-center/docs/connectivity-tests/how-to/running-connectivity-tests)."]]