本頁提供總覽,說明如何使用私人 IP 位址連線至 AlloyDB for PostgreSQL 執行個體。
使用私人 IP 位址可確保資料流量留在安全網路中,並盡量降低遭攔截的風險。資源的內部 IP 位址位於其網路內部,無法從網際網路存取,因此可有效限制資源存取 AlloyDB 執行個體的範圍,以及潛在的攻擊面。
私人 IP 連線方式
如要使用私人 IP 存取 AlloyDB 執行個體,您可以選擇私人服務存取權或 Private Service Connect。由於每種連線方法都有不同的優點和缺點,請根據本文資訊,為您的特定需求選擇最佳方法。
私人服務存取權
私人服務存取權會以虛擬私有雲 (VPC) 對等互連的方式運作,可連結您的虛擬私有雲網路與 AlloyDB for PostgreSQL 執行個體所在的基礎 Google Cloud 虛擬私有雲網路。私人連線提供內部 IP 位址,可讓虛擬私有雲網路中的 VM 執行個體和您存取的服務進行專屬通訊。VM 執行個體不需要網際網路存取權或外部 IP 位址,就可以透過私人服務存取權與服務連線。
[[["容易理解","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 (世界標準時間)。"],[[["\u003cp\u003eThis document outlines methods for connecting to AlloyDB for PostgreSQL instances using private IP addresses, ensuring data traffic remains within a secure network.\u003c/p\u003e\n"],["\u003cp\u003eTwo primary connection methods are available: private services access, which uses VPC peering, and Private Service Connect, which allows connections from multiple VPC networks.\u003c/p\u003e\n"],["\u003cp\u003ePrivate services access is suitable for smaller-scale, single-VPC setups with minimal costs, whereas Private Service Connect is ideal for larger, multi-VPC environments requiring higher security.\u003c/p\u003e\n"],["\u003cp\u003ePrivate services access requires reserving a CIDR range and is limited to RFC 1918 IP ranges, while Private Service Connect only requires a single IP address and supports both RFC 1918 and non-RFC 1918 ranges.\u003c/p\u003e\n"],["\u003cp\u003eThe chosen private IP access method for an AlloyDB cluster cannot be changed after creation, necessitating careful consideration during the initial setup.\u003c/p\u003e\n"]]],[],null,["# Private IP overview\n\nThis page provides an overview of the ways in which you can connect to your AlloyDB for PostgreSQL instance using private IP addresses.\n\nUsing private IP addresses keeps your data traffic within a secured network and minimizes risk of interception. A resource's internal IP address, being internal to its network and inaccessible from the internet, effectively limits both its scope of accessing an AlloyDB instance and potential attack surface.\n| **Note:** If you plan to use AlloyDB along with other Google Cloud services, then you can use Terraform templates for setup and management of Google Cloud networking infrastructure. For more information, see [Simplified Cloud Networking Configuration Solutions](https://github.com/GoogleCloudPlatform/cloudnetworking-config-solutions).\n\nPrivate IP connectivity methods\n-------------------------------\n\nTo access your AlloyDB instances using private IP, you can choose\neither private services access or Private Service Connect. Since each\nconnection method offers distinct advantages and trade-offs, use the information\nin this document to choose the best approach for your specific requirements.\n| **Caution:** Once you create your AlloyDB cluster, the private IP access method cannot be changed. Therefore, careful consideration is required during the initial setup process.\n\n### Private services access\n\nPrivate services access is implemented as a Virtual Private Cloud (VPC) peering connection between your VPC network and the underlying Google Cloud VPC network where your AlloyDB for PostgreSQL instance resides. The private connection enables VM instances in your VPC network and the services that you access to communicate exclusively by using internal IP addresses. VM instances don't need Internet access or external IP addresses to reach services that are available through private services access.\n\nTo automate the setup of AlloyDB clusters with private services access using Terraform, see [Deploy AlloyDB using Terraform](https://github.com/GoogleCloudPlatform/cloudnetworking-config-solutions/blob/main/docs/AlloyDB/alloydbinstance-using-psa-accessed-from-gce.md).\n\nFor more information about using private services access for connectivity, see [Private services access overview](/alloydb/docs/about-private-services-access).\n\n### Private Service Connect\n\n[Private Service Connect](/vpc/docs/private-service-connect) lets you create private and secure connections between your VPC networks and the Google Cloud service, such as AlloyDB for PostgreSQL. You can connect to your AlloyDB instance from multiple VPC networks that belong to different groups, teams, projects, or organizations. When you create an AlloyDB cluster, you can enable it to support Private Service Connect. When creating an AlloyDB instance within the cluster, you specify which projects from your VPC network can access it.\n\nFor more information about using Private Service Connect, see [Private Service Connect overview](/alloydb/docs/about-private-service-connect) and the video [What is Private Service Connect?](https://www.youtube.com/watch?v=JAFagcQBV08).\n\nChoose between methods to use\n-----------------------------\n\nBefore you make a decision about whether to use private services access or Private Service Connect as your connection method, consider the following comparison:\n\nWhat's next\n-----------\n\n- [Private services access overview](/alloydb/docs/about-private-services-access)\n- [Private Service Connect overview](/alloydb/docs/about-private-service-connect)\n- Watch a Cloud Skills Boost video to learn how to [use private services access to provide access to producer services](https://www.cloudskillsboost.google/paths/14/course_templates/36/video/500632)."]]