如要將流量識別為已設定 Data Transfer Essentials 計費,請選取服務並與所選端點建立關聯。本頁面說明如何建立必要的 Data Transfer Essentials 資源,也就是設定和目的地。
事前準備
建立資料移轉基本版設定或目的地之前,請先完成下列事項:
如果尚未安裝,請安裝 Google Cloud CLI。
使用您的帳戶驗證 gcloud CLI:
gcloud auth login
設定專案:
gcloud config set project PROJECT_ID
將
PROJECT_ID
替換為專案 ID。設定權限。
確認資料移轉基本版是否支援您要選取的服務。您只能為支援的服務和區域設定 Data Transfer Essentials。
gcloud
使用
gcloud network-connectivity multicloud-data-transfer-supported-services list
指令。gcloud network-connectivity multicloud-data-transfer-supported-services list \ --location=LOCATION
將
LOCATION
替換為 Google Cloud區域 ID,例如europe-west3
。下列輸出範例顯示,由於服務使用支援的層級,因此符合使用 Data Transfer Essentials 設定的資格。
NAME SERVICE_CONFIGS cloud-sql [{'eligibilityCriteria': 'NETWORK_SERVICE_TIER_PREMIUM_ONLY'}] cloud-storage [{'eligibilityCriteria': 'REQUEST_ENDPOINT_REGIONAL_ENDPOINT_ONLY'}] compute-engine [{'eligibilityCriteria': 'NETWORK_SERVICE_TIER_STANDARD_ONLY'}]
如要檢查特定服務是否符合資格,請使用
gcloud network-connectivity multicloud-data-transfer-supported-services describe
指令。gcloud network-connectivity multicloud-data-transfer-supported-services describe SERVICE1 \ --location=LOCATION
將
SERVICE1
替換成代表服務的有效字串。請參閱「支援的服務和區域」。API
請使用
multicloudDataTransferSupportedServices.get
方法。GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION:getMulticloudDataTransferSupportedServices
更改下列內容:
PROJECT_ID
:您的專案 IDLOCATION
:區域 ID,例如 Google Cloudeurope-west3
以下輸出範例列出可使用 Data Transfer Essentials 設定的服務,因為這些服務使用支援的層級。
{ "multicloudDataTransferSupportedServices": [ { "name": "cloud-sql", "serviceConfigs": [ { "eligibilityCriteria": "NETWORK_SERVICE_TIER_PREMIUM_ONLY" } ] }, { "name": "cloud-storage", "serviceConfigs": [ { "eligibilityCriteria": "REQUEST_ENDPOINT_REGIONAL_ENDPOINT_ONLY" } ] }, { "name": "compute-engine", "serviceConfigs": [ { "eligibilityCriteria": "NETWORK_SERVICE_TIER_STANDARD_ONLY" } ] } ] }
如要檢查特定服務是否符合資格,請使用下列方法:
GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION:getMulticloudDataTransferSupportedServices { "service": "SERVICE1" }
更改下列內容:
PROJECT_ID
:專案 ID。LOCATION
:區域 ID,例如europe-west3
。 Google CloudSERVICE1
:代表服務的有效字串。請參閱「支援的服務和區域」。
檢查您要指定的自治系統編號 (ASN) 是否已獲認可。您只能將流量設定為使用已識別 ASN 的目的地。
建立設定
建立包含指定服務的 Data Transfer Essentials 設定。每個專案的每個區域只能建立一項設定。
gcloud
使用 gcloud network-connectivity multicloud-data-transfer-configs create
指令。
gcloud network-connectivity multicloud-data-transfer-configs create CONFIGURATION_NAME \ --location=LOCATION \ --description=DESCRIPTION \ --services=SERVICE-A,...
更改下列內容:
CONFIGURATION_NAME
:設定的名稱。LOCATION
:設定的區域。DESCRIPTION
:設定的說明及其用途。SERVICE-A,...
:一系列字串,代表要設定資料移轉基本版的服務。如需有效字串,請參閱「支援的服務和區域」。
下列範例指令會在 europe-west3
區域中,為 compute-engine
、cloud-storage
和 cloud-sql
服務建立名為 config1
的設定。
gcloud network-connectivity multicloud-data-transfer-configs create config1 \ --location=europe-west3 \ --description="configuration for europe-west3" \ --services=compute-engine,cloud-storage,cloud-sql
API
請使用 multicloudDataTransferConfigs.create
方法。
POST https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME { "description": "DESCRIPTION", "services": { "SERVICE-A", "SERVICE-B" } }
更改下列內容:
PROJECT_ID
:專案 ID。LOCATION
:設定的區域。CONFIGURATION_NAME
:設定的名稱。DESCRIPTION
:設定的說明及其用途。SERVICE-A,...
:一系列字串,代表要設定資料移轉基本版的服務。如需有效字串,請參閱「支援的服務和區域」。
視需要使用 requestID
查詢參數來識別 API 要求。如果重試要求,伺服器可以使用 ID 忽略已回覆的要求。
下列 JSON 程式碼片段會為 compute-engine
、cloud-storage
和 cloud-sql
服務,在 europe-west3
區域中建立名為 config1
的設定。
POST https://networkconnectivity.googleapis.com/v1/projects/my-project/locations/europe-west3/multicloudDataTransferConfigs/config1 { "description": "configuration for europe-west3", "services": { "compute-engine": {}, "cloud-storage": {}, "cloud-sql": {} }
建立資料移轉基本設定最多需要 24 小時。如要查看設定狀態,請查看設定詳細資料。
如要新增或移除服務,請更新設定。
嘗試建立新設定前,請刪除現有設定。
為設定建立目的地
為 Data Transfer Essentials 設定建立目的地。目的地資源會在現有設定與具有端點的外部 IP 前置字串之間建立關聯。端點包含雲端服務供應商 (CSP) ID 和 ASN。
一次只能建立一個目的地。
gcloud
使用 gcloud network-connectivity multicloud-data-transfer-configs destinations create
指令。
gcloud network-connectivity multicloud-data-transfer-configs destinations create DESTINATION_NAME \ --multicloud-data-transfer-config=CONFIGURATION_NAME \ --location=LOCATION \ --description=DESCRIPTION \ --ip-prefix=IP_PREFIX \ --endpoints=asn=ASN,csp=CSP
更改下列內容:
DESTINATION_NAME
:目的地的名稱。 區域內的名稱不得重複。CONFIGURATION_NAME
:設定的名稱。LOCATION
:設定的區域。DESCRIPTION
:目的地及其用途的說明。IP_PREFIX
:指定為範圍 (例如203.0.113.0/24
或2001:db8::/32
) 或值 (例如203.0.113.6
或2001:db8:2:2:2:2:2:2
) 的目的地 IP 前置字元。IP 前置字元在設定中只能使用一次,且必須與至少一個端點建立關聯,最多可與 5 個端點建立關聯。指定要新增至目的地的端點對應字串:
ASN
:預期會發布前置字元的 ASN。請參閱「已識別的 ASN」。CSP
:代表公告前置字元 ASN 的 CSP 字串。
您可以在同一個指令中多次指定
endpoints
標記。目的地必須至少有一個端點,且不得超過五個端點。
下列範例指令會為指定 IP 前置字元和端點,在 europe-west3
區域中為設定 config1
建立名為 destination1
的目的地。
gcloud network-connectivity multicloud-data-transfer-configs destinations create destination1 \ --multicloud-data-transfer-config=config1 \ --location=europe-west3 \ --description="destination1 for config1" \ --ip-prefix=203.0.113.0/24 \ --endpoints=asn=16509,csp="aws"
API
請使用 multicloudDataTransferConfigs.destinations.create
方法。
POST https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME/destinations/DESTINATION_NAME { "description": "DESCRIPTION", "ipPrefix": "IP_PREFIX", "endpoints": [ { "asn": "ASN", "csp": "CSP" } ] }
更改下列內容:
PROJECT_ID
:專案 ID。LOCATION
:設定的區域。CONFIGURATION_NAME
:設定的名稱。DESTINATION_NAME
:目的地的名稱。 區域內的名稱不得重複。DESCRIPTION
:目的地及其用途的說明。IP_PREFIX
:指定為範圍 (例如203.0.113.0/24
或2001:db8::/32
) 或值 (例如203.0.113.6
或2001:db8:2:2:2:2:2:2
) 的目的地 IP 前置字串。IP 前置字串在設定中只能使用一次,且只能用於一個 ASN。指定要新增至目的地的端點對應字串:
ASN
:預期會發布前置字元的 ASN。請參閱「已識別的 ASN」。CSP
:代表前置字元發布 ASN 的 CSP 字串。
您可以在同一個呼叫中指定多個端點。目的地必須至少有一個端點,且不得超過五個端點。
下列範例指令會為指定 IP 前置字元和端點,在 europe-west3
區域中為設定 config1
建立名為 destination1
的目的地。
POST https://networkconnectivity.googleapis.com/v1/projects/my-project/locations/europe-west3/multicloudDataTransferConfigs/config1/destinations/destination1 { "description": "destination1 for config1", "ipPrefix": "203.0.113.0/24", "endpoints": [ { "asn": "16509", "csp": "aws" } ] }
如要檢查目的地狀態,請查看目的地詳細資料。
如要新增或移除端點,請更新目的地。
或者,刪除目的地。