This API is used to create one or two VPN connections for a VPN gateway in batches.
For details, see Calling APIs.
POST /v5/{project_id}/vpn-connections/batch-create
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
project_id |
String |
Yes |
Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID. |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
vpn_connections |
Array of |
Yes |
Specifies the vpn_connection object array. One or two VPN connections can be created at a time. |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
name |
String |
No |
|
vgw_id |
String |
Yes |
You can obtain the VPN gateway ID by querying the VPN gateway list. |
vgw_ip |
String |
Yes |
You can obtain the EIP IDs or private IP addresses of the VPN gateway by querying information about the VPN gateway. |
style |
String |
No |
|
cgw_id |
String |
Yes |
|
peer_subnets |
Array of String |
No |
|
tunnel_local_address |
String |
No |
|
tunnel_peer_address |
String |
No |
|
enable_nqa |
Boolean |
No |
|
enable_hub |
Boolean |
No |
|
psk |
String |
No |
|
policy_rules |
Array of PolicyRule object |
No |
Specifies IPv4 policy rules. A maximum of five policy rules can be specified. This parameter is mandatory only when style is set to policy and ip_version of the VPN gateway is set to ipv4. |
ikepolicy |
IkePolicy object |
No |
Specifies the IKE policy object. |
ipsecpolicy |
IpsecPolicy object |
No |
Specifies the IPsec policy object. |
ha_role |
String |
No |
|
tags |
Array of VpnResourceTag object |
No |
|
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
source |
String |
No |
|
destination |
Array of String |
No |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
ike_version |
String |
No |
|
phase1_negotiation_mode |
String |
No |
|
authentication_algorithm |
String |
No |
|
encryption_algorithm |
String |
No |
|
dh_group |
String |
No |
|
authentication_method |
String |
No |
|
lifetime_seconds |
Integer |
No |
|
local_id_type |
String |
No |
|
local_id |
String |
No |
|
peer_id_type |
String |
No |
|
peer_id |
String |
No |
|
dpd |
Dpd object |
No |
Specifies the DPD object. |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
timeout |
Integer |
No |
|
interval |
Integer |
No |
|
msg |
String |
No |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
authentication_algorithm |
String |
No |
|
encryption_algorithm |
String |
No |
|
pfs |
String |
No |
|
transform_protocol |
String |
No |
|
lifetime_seconds |
Integer |
No |
|
encapsulation_mode |
String |
No |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
key |
String |
Yes |
|
value |
String |
Yes |
|
POST https://{Endpoint}/v5/{project_id}/vpn-connections/batch-create
{
"vpn_connections": [
{
"vgw_ip": "0d0f4af1-42b9-41eb-97b9-b4d41a0bf9c4",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"peer_subnets": [
"192.168.2.0/24"
],
"psk": "abcd****"
},
{
"vgw_ip": "1fb97767-d780-4d8b-83bb-6f878f662005",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"peer_subnets": [
"192.168.2.0/24"
],
"psk": "abcd****"
}
]
}
POST https://{Endpoint}/v5/{project_id}/vpn-connections/batch-create
{
"vpn_connections": [
{
"vgw_ip": "0d0f4af1-42b9-41eb-97b9-b4d41a0bf9c4",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"style": "policy",
"peer_subnets": [
"192.168.2.0/24"
],
"psk": "abcd****",
"policy_rules": [
{
"source": "10.0.0.0/24",
"destination": [
"192.168.0.0/24"
]
}
]
},
{
"vgw_ip": "1fb97767-d780-4d8b-83bb-6f878f662005",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"style": "policy",
"peer_subnets": [
"192.168.2.0/24"
],
"psk": "abcd****",
"policy_rules": [
{
"source": "10.0.0.0/24",
"destination": [
"192.168.0.0/24"
]
}
]
}
]
}
POST https://{Endpoint}/v5/{project_id}/vpn-connections/batch-create
{
"vpn_connections": [
{
"name": "vpn-1655",
"vgw_ip": "0d0f4af1-42b9-41eb-97b9-b4d41a0bf9c4",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"style": "bgp",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.56.225/30",
"tunnel_peer_address": "169.254.56.226/30",
"psk": "abcd****",
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"dh_group": "group16",
"lifetime_seconds": 172800,
"local_id": "123***",
"peer_id": "456***",
"dpd": {
"timeout": 30,
"interval": 60,
"msg": "seq-notify-hash"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"pfs": "group16",
"transform_protocol": "esp",
"lifetime_seconds": 7200,
"encapsulation_mode": "tunnel"
}
},
{
"name": "vpn-1341",
"vgw_ip": "1fb97767-d780-4d8b-83bb-6f878f662005",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"style": "bgp",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.56.225/30",
"tunnel_peer_address": "169.254.56.226/30",
"psk": "abcd****",
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"dh_group": "group16",
"lifetime_seconds": 172800,
"local_id": "123***",
"peer_id": "456***",
"dpd": {
"timeout": 30,
"interval": 60,
"msg": "seq-notify-hash"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"pfs": "group16",
"transform_protocol": "esp",
"lifetime_seconds": 7200,
"encapsulation_mode": "tunnel"
}
}
]
}
Returned status code 201: successful operation
Parameter |
Type |
Description |
|---|---|---|
vpn_connections |
Array of CreateResponseVpnConnection object |
Specifies the vpn_connections object array. |
request_id |
String |
Specifies a request ID. |
Parameter |
Type |
Description |
|---|---|---|
id |
String |
|
name |
String |
|
vgw_id |
String |
|
vgw_ip |
String |
|
style |
String |
|
cgw_id |
String |
|
peer_subnets |
Array of String |
Specifies an IPv4 customer subnet. This parameter is not returned when attachment_type of the VPN gateway is set to ER and style is set to BGP or POLICY. |
tunnel_local_address |
String |
Specifies the tunnel interface address configured on the VPN gateway in route-based mode. This parameter is valid only when style is STATIC or BGP. |
tunnel_peer_address |
String |
Specifies the tunnel interface address configured on the customer gateway device in route-based mode. This parameter is valid only when style is STATIC or BGP. |
enable_nqa |
Boolean |
|
policy_rules |
Array of PolicyRule objects |
Specifies IPv4 policy rules, which are returned only when style is set to POLICY and ip_version of the VPN gateway is set to ipv4. |
ikepolicy |
IkePolicy object |
Specifies the IKE policy object. |
ipsecpolicy |
IpsecPolicy object |
Specifies the IPsec policy object. |
created_at |
String |
|
updated_at |
String |
|
enterprise_project_id |
String |
|
ha_role |
String |
|
tags |
Array of VpnResourceTag objects |
Specifies a tag list. |
Parameter |
Type |
Description |
|---|---|---|
source |
String |
Specifies a source CIDR block. |
destination |
Array of String |
Specifies a destination CIDR block. An example IPv4 CIDR block is 192.168.52.0/24. A maximum of 50 destination CIDR blocks can be returned for each policy rule. |
Parameter |
Type |
Description |
|---|---|---|
ike_version |
String |
|
phase1_negotiation_mode |
String |
|
authentication_algorithm |
String |
|
encryption_algorithm |
String |
|
dh_group |
String |
|
authentication_method |
String |
|
lifetime_seconds |
Integer |
|
local_id_type |
String |
|
local_id |
String |
Specifies the local ID. When local_id_type is set to ip, the local ID specified when the VPN connection is created or updated is returned. If no local ID is specified, the VPN gateway IP address corresponding to the VPN connection is returned. |
peer_id_type |
String |
|
peer_id |
String |
Specifies the peer ID. When peer_id_type is set to ip, the peer ID specified when the VPN connection is created or updated is returned. If no peer ID is specified, the IP address of the customer gateway is returned. |
dpd |
Dpd object |
Specifies the DPD object. |
Parameter |
Type |
Description |
|---|---|---|
timeout |
Integer |
|
interval |
Integer |
|
msg |
String |
Parameter |
Type |
Description |
|---|---|---|
authentication_algorithm |
String |
|
encryption_algorithm |
String |
|
pfs |
String |
|
transform_protocol |
String |
|
lifetime_seconds |
Integer |
|
encapsulation_mode |
String |
Parameter |
Type |
Description |
|---|---|---|
key |
String |
|
value |
String |
|
{
"vpn_connections": [
{
"id": "cf91c03c-9679-495f-a201-3622a1aec817",
"name": "vpn-b8fa",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"vgw_ip": "0d0f4af1-42b9-41eb-97b9-b4d41a0bf9c4",
"style": "STATIC",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.12.37/30",
"tunnel_peer_address": "169.254.12.38/30",
"enable_nqa": false,
"policy_rules": [],
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"dh_group": "group15",
"authentication_method": "pre-share",
"lifetime_seconds": 86400,
"local_id_type": "ip",
"local_id": "10.***.***.173",
"peer_id_type": "ip",
"peer_id": "2.***.***.2",
"dpd": {
"interval": 30,
"timeout": 15,
"msg": "seq-hash-notify"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"pfs": "group15",
"transform_protocol": "esp",
"lifetime_seconds": 3600,
"encapsulation_mode": "tunnel"
},
"created_at": "2025-02-21T03:53:23.557Z",
"updated_at": "2025-02-21T03:53:23.557Z",
"enterprise_project_id": "0",
"ha_role": "master",
"tags": [],
},
{
"id": "64c09578-a23c-4d9d-9c64-56b2f9a74695",
"name": "vpn-ec21",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"vgw_ip": "1fb97767-d780-4d8b-83bb-6f878f662005",
"style": "STATIC",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.60.229/30",
"tunnel_peer_address": "169.254.60.230/30",
"enable_nqa": false,
"policy_rules": [],
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"dh_group": "group15",
"authentication_method": "pre-share",
"lifetime_seconds": 86400,
"local_id_type": "ip",
"local_id": "215.***.***.55",
"peer_id_type": "ip",
"peer_id": "2.***.***.2",
"dpd": {
"interval": 30,
"timeout": 15,
"msg": "seq-hash-notify"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"pfs": "group15",
"transform_protocol": "esp",
"lifetime_seconds": 3600,
"encapsulation_mode": "tunnel"
},
"created_at": "2025-02-21T03:53:23.226Z",
"updated_at": "2025-02-21T03:53:23.226Z",
"enterprise_project_id": "0",
"ha_role": "master",
"tags": [],
}
],
"request_id": "3c53db019753c69323303c198af58a85"
}
{
"vpn_connections": [
{
"id": "db06a7cb-e3b5-4c8c-b682-40ed54e8eb54",
"name": "vpn-ed37",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"vgw_ip": "1fb97767-d780-4d8b-83bb-6f878f662005",
"style": "POLICY",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.44.197/30",
"tunnel_peer_address": "169.254.44.198/30",
"policy_rules": [
{
"rule_index": 1,
"source": "192.168.37.0/24",
"destination": [
"192.168.2.0/24"
]
}
],
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"dh_group": "group15",
"authentication_method": "pre-share",
"lifetime_seconds": 86400,
"local_id_type": "ip",
"local_id": "215.***.***.55",
"peer_id_type": "ip",
"peer_id": "2.***.***.2",
"dpd": {
"interval": 30,
"timeout": 15,
"msg": "seq-hash-notify"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"pfs": "group15",
"transform_protocol": "esp",
"lifetime_seconds": 3600,
"encapsulation_mode": "tunnel"
},
"created_at": "2025-02-21T03:59:50.341Z",
"updated_at": "2025-02-21T03:59:50.341Z",
"enterprise_project_id": "0",
"ha_role": "master",
"tags": [],
},
{
"id": "9f5220fd-f674-420c-9df7-6b6420a3ae99",
"name": "vpn-d0c2",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"vgw_ip": "0d0f4af1-42b9-41eb-97b9-b4d41a0bf9c4",
"style": "POLICY",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.192.61/30",
"tunnel_peer_address": "169.254.192.62/30",
"policy_rules": [
{
"rule_index": 1,
"source": "192.168.37.0/24",
"destination": [
"192.168.2.0/24"
]
}
],
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"dh_group": "group15",
"authentication_method": "pre-share",
"lifetime_seconds": 86400,
"local_id_type": "ip",
"local_id": "10.***.***.173",
"peer_id_type": "ip",
"peer_id": "2.***.***.2",
"dpd": {
"interval": 30,
"timeout": 15,
"msg": "seq-hash-notify"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-256",
"encryption_algorithm": "aes-128",
"pfs": "group15",
"transform_protocol": "esp",
"lifetime_seconds": 3600,
"encapsulation_mode": "tunnel"
},
"created_at": "2025-02-21T03:59:50.651Z",
"updated_at": "2025-02-21T03:59:50.651Z",
"enterprise_project_id": "0",
"ha_role": "master",
"tags": [],
}
],
"request_id": "81237dad5e1338b1818cd6582781b610"
}
{
"vpn_connections": [
{
"id": "5ddf5d02-c746-4075-be4b-95e9213e1c3c",
"name": "vpn-1655",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"vgw_ip": "0d0f4af1-42b9-41eb-97b9-b4d41a0bf9c4",
"style": "BGP",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.56.225/30",
"tunnel_peer_address": "169.254.56.226/30",
"enable_hub": false,
"policy_rules": [],
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"dh_group": "group16",
"authentication_method": "pre-share",
"lifetime_seconds": 172800,
"local_id": "123***",
"peer_id": "456***",
"dpd": {
"interval": 60,
"timeout": 30,
"msg": "seq-notify-hash"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"pfs": "group16",
"transform_protocol": "esp",
"lifetime_seconds": 7200,
"encapsulation_mode": "tunnel"
},
"created_at": "2025-02-21T06:50:25.238Z",
"updated_at": "2025-02-21T06:50:25.238Z",
"enterprise_project_id": "0",
"ha_role": "master",
"tags": [],
},
{
"id": "bb3632dd-f517-4e94-96b7-977c70d28966",
"name": "vpn-1341",
"vgw_id": "8030f6d6-32a8-4d20-a7f8-50a7a826e2f8",
"vgw_ip": "1fb97767-d780-4d8b-83bb-6f878f662005",
"style": "BGP",
"cgw_id": "12f3577a-cbd8-4602-b68c-ecbf792fcec5",
"peer_subnets": [
"192.168.2.0/24"
],
"tunnel_local_address": "169.254.56.225/30",
"tunnel_peer_address": "169.254.56.226/30",
"enable_hub": false,
"policy_rules": [],
"ikepolicy": {
"ike_version": "v2",
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"dh_group": "group16",
"authentication_method": "pre-share",
"lifetime_seconds": 172800,
"local_id": "123***",
"peer_id": "456***",
"dpd": {
"interval": 60,
"timeout": 30,
"msg": "seq-notify-hash"
}
},
"ipsecpolicy": {
"authentication_algorithm": "sha2-512",
"encryption_algorithm": "aes-256",
"pfs": "group16",
"transform_protocol": "esp",
"lifetime_seconds": 7200,
"encapsulation_mode": "tunnel"
},
"created_at": "2025-02-21T06:50:25.5Z",
"updated_at": "2025-02-21T06:50:25.5Z",
"enterprise_project_id": "0",
"ha_role": "master",
"tags": [],
}
],
"request_id": "938ea2bba48836a429c741bd6f7627a4"
}
For details, see Status Codes.