您可以選擇在產品服務執行的環境中使用虛擬私有雲 (VPC),但必須完成下列步驟,才能將 Google Cloud Marketplace 報表與 VPC 整合。根據預設,虛擬私有雲網路中的 Compute Engine 虛擬機器 (VM) 只能在內部通訊。您必須設定其中一個 VM 與外部通訊,這樣虛擬私有雲端網路中的其他 VM 才能用於回報。
事前準備
- 在服務環境中設定偏好的 VPC 實作方式。如要瞭解設定虛擬私有雲的步驟,請參閱「 建立及修改虛擬私有雲 (VPC) 網路」一文。
- 請確認您具備 Google Cloud 專案的 Compute Network Admin 身分與存取權管理 (IAM) 角色。
設定私人 Google 存取權
如要讓產品的 Compute Engine 虛擬機器 (VM) 為了回報目的與外部溝通,您必須設定 私人 Google 存取權。如要進一步瞭解如何設定私人 Google 存取權,請參閱「設定私人 Google 存取權」。
為服務環境啟用私人 Google 存取權。
設定 DNS,將要求解析為
private.googleapis.com
。為 Google API 建立自訂路徑:
- 將「Name」指定為
route-google-apis-services
。 - 在「Network」 中,選取您的 VPC。
- 在「目的地 IP 範圍」中指定
199.36.153.8/30
。 - 在「Priority」(優先順序) 中指定
0
。 - 將「Instance tags」(執行個體標記) 指定為
google-apis-services
。 - 在「Next hop」中,選取「Default internet gateway」。
- 將「Name」指定為
建立 VPC 防火牆規則,讓產品能夠與 Google API 通訊:
- 將「Name」指定為
google-apis-services
。 - 在「Description」 中指定
Allow egress traffic to Google APIs and services
。 - 啟用防火牆規則記錄。
- 在「Network」 中,選取您的 VPC。
- 在「流量方向」中,選取「輸出」。
- 在「相符時執行的動作」中,選取「允許」。
- 在「Targets」中選取
Specified target tags
,然後在「Target tags」中指定google-apis-services
。 - 在「Destination filter」中選取
IPv4 ranges
,並在「Destination IPv4 ranges」中指定199.36.153.8/30
。 - 在「Protocols and ports」(通訊協定和通訊埠) 中選取
Allow all
。
- 將「Name」指定為
在 Google Cloud 控制台中,選取要用來回報產品使用情形的 VM。在「網路標記」下方新增
google-apis-services
,然後按一下「儲存」。在「Network interfaces」(網路介面) 下方,找出 VPC 的網路介面。
在「子網路」欄中,按一下子網路連結。在「子網路詳細資料」頁面中,按一下「編輯」,然後將「私人 Google 存取權」設為「開啟」。
按一下 [儲存]。