全部產品
Search
文件中心

VPN Gateway:CreateCustomerGateway - 建立使用者網關

更新時間:Apr 27, 2026

調用CreateCustomerGateway介面建立使用者網關。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

當前API暫無授權資訊透出。

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

使用者網關所在的地區 ID。

您可以通過調用 DescribeRegions 介面擷取地區 ID。

cn-shanghai

ClientToken

string

用戶端 Token,用於保證請求的等冪性。

由用戶端產生該參數值,要保證在不同請求間唯一,最大值不超過 64 個 ASCII 字元。

說明

若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 不一樣。

02fb3da4-130e-11e9-8e44****

IpAddress

string

輸入本機資料中心網關裝置的靜態 IP 位址。

  • 如果您後續需要建立公網網路類型的 IPsec 串連,則此處需要輸入公網 IP 位址。

  • 如果您後續需要建立私網網路類型的 IPsec 串連,則此處需要輸入私網 IP 位址。

不支援使用以下 IP 位址,否則無法建立 IPsec-VPN 串連:

  • 100.64.0.0~100.127.255.255

  • 127.0.0.0~127.255.255.255

  • 169.254.0.0~169.254.255.255

  • 224.0.0.0~239.255.255.255

  • 255.0.0.0~255.255.255.255

101.12.XX.XX

Name

string

使用者網關的名稱。

名稱長度為 1~100 個字元,不能以http://https://開頭。

nametest

Description

string

使用者網關的描述資訊。

描述資訊長度為 1~100 個字元,不能以http://https://開頭。

desctest

Asn

string

如果 IPsec-VPN 串連計劃啟用 BGP 動態路由協議,則需要配置本機資料中心網關裝置的自治系統號 ASN(Autonomous System Number)。自治系統號取值範圍:1~4294967295,不支援使用 45104。

Asn 是一個 4 位元組的號碼,支援按照兩段位的格式進行輸入,即:前 16 位位元.後 16 位位元。每個段位使用十進位輸入。

例如輸入 123.456,則表示自治系統號:123*65536+456=8061384。

說明
  • 建議您使用自治系統號的私人號碼與阿里雲建立 BGP 串連。自治系統號的私人號碼範圍請自行查閱文檔。

  • 45104 是由全球互連網數字分配機構 IANA 分配給阿里雲計算有限公司的唯一識別碼,用於在全球互連網路由選擇和資料轉送中標識阿里雲。

65530

AuthKey

string

本機資料中心網關裝置 BGP 路由協議的認證密鑰。

密鑰長度為 1~64 個字元,只支援 ASCII 字元,不支援空格、中文和半形問號(?)。

AuthKey****

Tags

array<object>

使用者網關待添加的標籤列表。

一次最多支援為使用者網關添加 20 個標籤。

object

標籤資訊。

Key

string

標籤鍵。一旦輸入該值,則不允許為空白字串。

最多支援 64 個字元,不能以aliyunacs:開頭,不能包含http://或者https://

一次最多支援輸入 20 個標籤鍵。

TagKey

Value

string

標籤值。

標籤值最多支援 128 個字元,可以為空白字串,不能以aliyunacs:開頭,不能包含http://或者https://

一個標籤鍵對應一個標籤值。一次最多支援輸入 20 個標籤值。

TagValue

ResourceGroupId

string

使用者網關所屬的資源群組 ID。

  • 您可以調用 ListResourceGroups 介面查詢資源群組 ID。

  • 如果您未指定資源群組,使用者網關建立後將歸屬於預設資源群組。

rg-aek2qo2h4jy****

返回參數

名稱

類型

描述

樣本值

object

返回結果

RequestId

string

請求 ID。

D32B3C26-6C6C-4988-93E9-D2A6444CE6AE

IpAddress

string

本機資料中心網關裝置的靜態 IP 位址。

101.12.XX.XX

Description

string

使用者網關的描述資訊。

desctest

CustomerGatewayId

string

使用者網關的執行個體 ID。

cgw-bp1jrawp82av6bws9****

CreateTime

integer

建立使用者網關的時間戳記。單位:毫秒。

時間戳記的格式採用 Unix 時間戳記,表示從格林威治時間 1970 年 01 月 01 日 00 時 00 分 00 秒至建立使用者網關時的總時間長度。

1493363486000

Name

string

使用者網關的名稱。

nametest

樣本

正常返回樣本

JSON格式

{
  "RequestId": "D32B3C26-6C6C-4988-93E9-D2A6444CE6AE",
  "IpAddress": "101.12.XX.XX",
  "Description": "desctest",
  "CustomerGatewayId": "cgw-bp1jrawp82av6bws9****",
  "CreateTime": 1493363486000,
  "Name": "nametest"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidAuthkey.Malformed The specified BGP authentication key (%s) is malformed. 該BGP認證密鑰不合法。
400 InvalidIpAddress.AlreadyExist Specified IpAddress is already exist. 該IP地址已經存在。原因是同一個使用者在同一個地區內,IP地址不可重複。
400 InvalidIpAddress.WrongFormat Specified IpAddress is invalid.
400 InvalidName The name is not valid
400 InvalidDescription The description is not valid
400 Resource.QuotaFull The quota of resource is full
400 IllegalParam.Asn The specified Asn is invalid. 指定的Asn不合規範。
400 OperationDenied.MissingAsn The autonomous system number of the customer gateway is mandatory when BGP authentication key is specified. 當指定了使用者網關的BGP驗證密鑰時,必須指定自治系統號。
400 InvalidParameter.TagValue The specified parameter TagValue is invalid. 指定的參數TagValue不合規範。
400 SizeLimitExceeded.TagNum The maximum number of tags is exceeded. 標籤數量超限
400 Forbidden.TagKey.Duplicated The specified tag key already exists. 標籤資源重複
400 InvalidParameter.TagKey The specified parameter TagKey is invalid. 指定的參數TagKey不合規範。
400 Duplicated.TagKey The specified parameter TagKey is duplicated. 指定的參數TagKey重複。
400 OperationFailed.NoRamPermission Vpn Service has no permission to operate your IDaaS instances. Vpn服務沒有許可權操作您的IDaaS執行個體
400 CreateVpnUserGatewayQuotaFull.QuotaFull The number of created VPN customer gateways exceeds the quota. 建立VPN使用者網關數量超出配額。
403 Forbidden.SubUser User not authorized to operate on the specified resource as your account is created by another user. 您沒有許可權操作該資源,請您申請操作許可權後再試。
403 Forbidden User not authorized to operate on the specified resource. 您沒有許可權操作指定資源,請申請許可權後再操作。
409 OperationConflict The operation against this instance is too frequent, please try again later. 對該執行個體的操作過於頻繁,請稍後重試。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情