Connect an Alibaba Cloud Virtual Private Cloud (VPC) to an AWS VPC over an encrypted IPsec-VPN tunnel. You create one dual-tunnel IPsec-VPN connection on Alibaba Cloud and two site-to-site VPN connections on AWS — one per tunnel — so that both tunnels stay active and provide high availability.
This procedure incurs charges on both platforms. Alibaba Cloud charges for the VPN Gateway instance and data transfer. AWS charges for the site-to-site VPN connections and data transfer.
What you'll do
| Step | Action | Platform |
|---|---|---|
| 1 | Create a VPN Gateway instance | Alibaba Cloud |
| 2 | Create customer gateways, a virtual private gateway, and site-to-site VPN connections | AWS |
| 3 | Create customer gateways and an IPsec-VPN connection; configure routes | Alibaba Cloud |
| 4 | Verify connectivity and test failover | Both |
Estimated time: 30–60 minutes (excluding gateway provisioning, which takes 1–5 minutes).
Example scenario
An enterprise has a VPC in the Alibaba Cloud Germany (Frankfurt) region and a VPC in the AWS Europe (Frankfurt) region and wants to enable encrypted communication between them.
Network planning
The CIDR blocks of the networks you want to connect must not overlap.
VPC CIDR blocks
| Resource | VPC CIDR block | vSwitch/subnet | Zone | Instance IP |
|---|---|---|---|---|
| Alibaba Cloud VPC | 10.0.0.0/16 | vSwitch 1: 10.0.0.0/24 | Zone B | ECS: 10.0.0.223 |
| vSwitch 2: 10.0.10.0/24 | Zone C | |||
| AWS VPC | 192.168.0.0/16 | Subnet: 192.168.10.0/24 | eu-central-1a | EC2: 192.168.10.113 |
BGP CIDR block planning
Skip this section if you plan to use static routing only.
Both tunnels on the Alibaba Cloud side must use the same Local ASN. The peer BGP ASNs for the two tunnels can differ, but using the same peer BGP ASN for both is recommended.
| Resource | Connection | Tunnel | BGP tunnel CIDR block | BGP IP address | Local ASN |
|---|---|---|---|---|---|
| Alibaba Cloud VPN Gateway | IPsec-VPN connection | Primary tunnel | 169.254.116.208/30 | 169.254.116.210 | 65530 |
| Standby tunnel | 169.254.214.96/30 | 169.254.214.98 | |||
| AWS virtual private gateway | Site-to-Site VPN Connection 1 | Tunnel 1 | 169.254.116.208/30 | 169.254.116.209 | 64512 |
| Tunnel 2 | (not used) | ||||
| Site-to-Site VPN Connection 2 | Tunnel 1 | 169.254.214.96/30 | 169.254.214.97 | ||
| Tunnel 2 | (not used) | ||||
Each BGP tunnel CIDR block must be unique within a VPN Gateway instance.
Prerequisites
Before you begin, make sure you have:
-
A VPC in the Alibaba Cloud Germany (Frankfurt) region with at least two vSwitches in different zones, and an Elastic Compute Service (ECS) instance deployed in it. See Create a VPC with an IPv4 CIDR block.
-
A VPC in the AWS Europe (Frankfurt) region with an EC2 instance deployed in it. See the AWS platform.
Step 1: Create a VPN Gateway instance on Alibaba Cloud
The VPN Gateway is the Alibaba Cloud-side endpoint. After creation, the system assigns two IP addresses to it — one per tunnel — which you use when configuring the AWS side.
-
Log on to the VPN Gateway console.
-
In the top navigation bar, select Germany (Frankfurt). The VPN Gateway must be in the same region as the VPC you want to connect.
-
On the VPN Gateways page, click Create VPN Gateway.
-
On the purchase page, configure the following settings. For parameters not listed here, keep the default values. For details, see Create and manage a VPN Gateway instance.
After a VPN Gateway instance is created, you cannot change its associated vSwitches.
Parameter Description Example value Instance Name Name for the VPN Gateway instance. VPN Gateway Region Region where the VPN Gateway is located. Germany (Frankfurt) Gateway Type Type of the VPN Gateway instance. Standard Network Type Network type of the VPN Gateway instance. Public Tunnel Tunnel mode for IPsec-VPN connections in this region. Options: Dual-tunnel or Single-tunnel. Dual-tunnel (default) VPC VPC to associate with the VPN Gateway instance. VPC in Alibaba Cloud Germany (Frankfurt) region vSwitch First vSwitch in the VPC. In dual-tunnel mode, the system creates an elastic network interface (ENI) in each vSwitch for VPC-to-IPsec-VPN traffic. Each ENI occupies one IP address in its vSwitch. First vSwitch in the VPC vSwitch 2 Second vSwitch in the VPC, in a different zone. This enables zone-level disaster recovery for the IPsec-VPN connection. For regions with only one zone, you can select any vSwitch — even the same one as vSwitch 1. Second vSwitch in the VPC IPsec-VPN Whether to enable the IPsec-VPN feature. Default: Enable. Enable SSL-VPN Whether to enable the SSL-VPN feature. Default: Disable. Disable -
Click Buy Now and complete the payment.
-
Return to the VPN Gateways page. Wait until the status changes from Preparing to Active (1–5 minutes). The system assigns two IP addresses to the instance: Keep these IP addresses on hand — you use them in Step 2.
VPN Gateway name VPN Gateway instance ID IP address VPN Gateway vpn-gw8dickm386d2qi2g**** IPsec Address 1 (active tunnel): 8.XX.XX.146 IPsec Address 2 (standby tunnel): 8.XX.XX.74
Step 2: Deploy the VPN on AWS
Both Alibaba Cloud and AWS IPsec-VPN connections support dual-tunnel mode. However, AWS associates both tunnels with the same customer gateway by default, while the two tunnels on the Alibaba Cloud side have different IP addresses. To establish a one-to-one tunnel mapping, create two separate site-to-site VPN connections on AWS, each associated with a different customer gateway.
Configure the AWS side based on your routing method. For specific console steps, refer to the AWS documentation.
Use static routing
-
Create two customer gateways. Use the two IP addresses of the Alibaba Cloud VPN Gateway instance as the customer gateway IP addresses.

-
Create a virtual private gateway. Create a virtual private gateway and attach it to the AWS VPC.

-
Create two site-to-site VPN connections. Associate each VPN connection with a different customer gateway. The figure below shows the configuration for one connection — the other uses the second customer gateway with the same remaining settings. Keep the tunnel options at their default values. After creation, note the outside IP address of Tunnel 1 for each VPN connection — you use these in Step 3.
Set Local IPv4 Network CIDR to the Alibaba Cloud VPC CIDR block and Remote IPv4 Network CIDR to the AWS VPC CIDR block.
Site-to-site VPN connection Tunnel Outside IP address Associated customer gateway IP Site-to-Site VPN Connection 1 Tunnel 1 3.XX.XX.52 8.XX.XX.146 Site-to-Site VPN Connection 2 Tunnel 1 3.XX.XX.56 8.XX.XX.74 

-
Enable route propagation. In the route table of the VPC associated with the virtual private gateway, enable route propagation so that routes from the site-to-site VPN connections are automatically propagated to the VPC route table.

Use BGP dynamic routing
-
Create two customer gateways. Use the two IP addresses of the Alibaba Cloud VPN Gateway instance as the customer gateway IP addresses. Register the BGP Autonomous System Number (ASN) of the Alibaba Cloud IPsec-VPN connection.

-
Create a virtual private gateway. Create a virtual private gateway, specify the BGP ASN for the AWS side, and attach the gateway to the AWS VPC.

-
Create two site-to-site VPN connections. Associate each VPN connection with a different customer gateway. The figure below shows the configuration for one connection. For the second connection, set Tunnel 1 Inside IPv4 CIDR to
169.254.214.96/30; all other settings are the same. After creation, view the tunnel details to get the outside IP addresses and BGP IP addresses.Set Local IPv4 Network CIDR to the Alibaba Cloud VPC CIDR block and Remote IPv4 Network CIDR to the AWS VPC CIDR block.


-
Get the pre-shared key and BGP IP addresses for the Alibaba Cloud side. Download the VPN configuration file for the Alibaba Cloud VPN Gateway from the AWS console. The file contains the pre-shared keys and BGP IP addresses you need for Step 3. When downloading, select Generic for Vendor and IKEv2 for IKE version. See Download the configuration file. View the pre-shared key: View the Alibaba Cloud BGP IP address: The outside IP addresses, BGP IP addresses, and associated customer gateway IP addresses for Tunnel 1 of each VPN connection:
If you specified a pre-shared key when creating the site-to-site VPN connection, you don't need to look it up in the configuration file. If you used a system-generated key, find it in the file. The pre-shared keys on the Alibaba Cloud and AWS sides must match.
Site-to-site VPN connection Tunnel Outside IP address AWS BGP IP address Alibaba Cloud BGP IP address Associated customer gateway IP Site-to-Site VPN Connection 1 Tunnel 1 3.XX.XX.52 169.254.116.209 169.254.116.210 8.XX.XX.146 Site-to-Site VPN Connection 2 Tunnel 1 3.XX.XX.56 169.254.214.97 169.254.214.98 8.XX.XX.74 

-
Enable route propagation. In the route table of the VPC associated with the virtual private gateway, enable route propagation so that routes from the site-to-site VPN connections are automatically propagated to the AWS VPC route table.

Step 3: Deploy the VPN Gateway on Alibaba Cloud
With the AWS side ready, configure the Alibaba Cloud side to complete the IPsec-VPN connection.
Create customer gateways
-
Log on to the VPN Gateway console.
-
In the left-side navigation pane, choose Interconnections > VPN > Customer Gateways.
-
In the top navigation bar, select Germany (Frankfurt). The customer gateway and the VPN Gateway must be in the same region.
-
On the Customer Gateways page, click Create Customer Gateway.
-
In the Create Customer Gateway panel, configure the following settings and click OK. Create two customer gateways using the outside IP addresses of Tunnel 1 from each AWS site-to-site VPN connection. For parameters not listed here, keep the default values. See Customer gateways.
ImportantUse only the outside IP address of Tunnel 1 from each AWS site-to-site VPN connection. The outside IP address of Tunnel 2 is not used. After the IPsec-VPN connection is created, Tunnel 2 of each AWS site-to-site VPN connection remains disconnected by default.
Parameter Description Customer Gateway 1 Customer Gateway 2 Name Name for the customer gateway. Customer Gateway 1 Customer Gateway 2 IP Address Outside IP address of the AWS tunnel. 3.XX.XX.52 3.XX.XX.56 ASN BGP ASN of the AWS virtual private gateway. Required for BGP dynamic routing. 64512 64512
Create an IPsec-VPN connection
-
In the left-side navigation pane, choose Interconnections > VPN > IPsec Connections.
-
On the IPsec Connections page, click Bind VPN Gateway.
-
On the Create IPsec-VPN Connection page, configure the following settings and click OK.
Parameter Description Example value IPsec-VPN Connection Name Name for the IPsec-VPN connection. IPsec-VPN connection Region Region where the VPN Gateway is deployed. Germany (Frankfurt) Attach a VPN Gateway VPN Gateway instance to associate with the IPsec-VPN connection. VPN Gateway (created in Step 1) Routing Mode How traffic is routed through the tunnel. Destination-based Routing routes by destination IP. Traffic Of Interest Pattern routes by source and destination IP pair. Static routing: select Traffic Of Interest Pattern (Recommended). Set Local Network to 10.0.0.0/16and Remote Network to192.168.0.0/16. BGP dynamic routing: select Destination-based Routing (recommended).Effective Immediately Whether to start IKE negotiation immediately after configuration. Yes: negotiation starts immediately. No: negotiation is triggered by traffic. Yes Enable BGP Whether to use BGP dynamic routing. Disabled by default. To use BGP, enable it after the connection is created and add BGP configurations separately. Disabled (static routing). Enable after creation for BGP. Tunnel 1 – Customer Gateway Customer gateway for the active tunnel. Customer Gateway 1 Tunnel 1 – Pre-Shared Key Authentication key for the active tunnel. 1–100 characters: digits, letters, and special characters ` ~!@#$%^&*()_-+={}[]|;:',.<>/?``. Must match the key configured on the connected AWS tunnel.Same as the AWS tunnel pre-shared key Tunnel 1 – Encryption Configurations IKE, IPsec, DPD, and NAT traversal settings. Under IKE Configurations, set SA Life Cycle (seconds) to 28800. Under IPsec Configurations, set SA Life Cycle (seconds) to3600. Keep all other values at their defaults. See Configure IPsec-VPN connections.Tunnel 2 – Customer Gateway Customer gateway for the standby tunnel. Customer Gateway 2 Tunnel 2 – Pre-Shared Key Authentication key for the standby tunnel. Must match the key on the connected AWS tunnel. Same as the AWS tunnel pre-shared key Tunnel 2 – Encryption Configurations IKE, IPsec, DPD, and NAT traversal settings. Same as Tunnel 1: IKE SA Life Cycle 28800s, IPsec SA Life Cycle3600s. -
In the Created message, click Cancel.
Configure VPN Gateway routes
Static routing
After you create an IPsec-VPN connection, if you selected Policy-based Routing for Routing Mode, the system automatically creates a policy-based route in the VPN Gateway instance with an Unpublished state. Publish the route to the VPC:
-
In the left-side navigation pane, choose Interconnections > VPN > VPN Gateways.
-
In the top navigation bar, select the region where the VPN Gateway resides.
-
On the VPN Gateways page, click the ID of the VPN Gateway.
-
On the details page, click the Policy-based Route Table tab. Find the route and click Advertise in the Actions column.
-
In the Advertise Route dialog box, click OK.
BGP dynamic routing
-
Add BGP configurations to the IPsec-VPN connection.
-
In the left-side navigation pane, choose Interconnections > VPN > IPsec Connections.
-
On the IPsec Connections page, click the ID of the IPsec-VPN connection.
-
In the IPsec Connections section, turn on Enable BGP. In the BGP Configuration dialog box, configure the following settings and click OK.
Parameter
Description
Value
Local ASN
Autonomous system number for the IPsec-VPN connection.
65530
Tunnel 1 – Tunnel CIDR Block
CIDR block for the active tunnel.
169.254.116.208/30
Tunnel 1 – Local BGP IP address
BGP IP address for the active tunnel. Must be within the tunnel CIDR block.
169.254.116.210
Tunnel 2 – Tunnel CIDR Block
CIDR block for the standby tunnel.
169.254.214.96/30
Tunnel 2 – Local BGP IP address
BGP IP address for the standby tunnel. Must be within the tunnel CIDR block.
169.254.214.98
-
-
Enable automatic BGP route propagation for the VPN Gateway.
-
In the left-side navigation pane, choose Interconnections > VPN > VPN Gateways.
-
On the VPN Gateways page, find the VPN Gateway instance. In the Actions column, choose
> Enable Automatic BGP Propagation. -
In the Enable Automatic BGP Propagation dialog box, click OK.
-
Step 4: Verify connectivity
Check the VPN connection status
Before running end-to-end tests, confirm that the IPsec-VPN connection is established:
-
In the VPN Gateway console, go to Interconnections > VPN > IPsec Connections.
-
Find the IPsec-VPN connection you created. Confirm that the tunnel status shows Connected.
If the status is not Connected, check:
-
That the pre-shared keys on both sides match.
-
That the IKE SA Life Cycle and IPsec SA Life Cycle values match on both sides (28800 s and 3600 s respectively).
-
That security group rules and network ACLs on both the Alibaba Cloud and AWS sides allow traffic between the two VPC CIDR blocks.
Test end-to-end connectivity
Before testing, verify that the network ACLs and security group rules on both platforms allow traffic between the two VPCs.
-
Log on to an ECS instance in the Alibaba Cloud VPC. See Select a remote connection method for an ECS instance.
-
Run
pingto reach the AWS EC2 instance:ping <private IP address of the AWS EC2 instance>If the ECS instance receives replies, the two VPCs can communicate.

Test high-availability failover
A dual-tunnel IPsec-VPN connection provides automatic failover: if the active tunnel fails, traffic switches to the standby tunnel.
-
Stay logged on to the ECS instance and run a continuous ping:
ping <private IP address of the AWS EC2 instance> -c 10000 -
Interrupt the active tunnel by changing its pre-shared key on the Alibaba Cloud side. A key mismatch causes the tunnel to drop.
-
Watch the ping output. After a brief interruption, traffic automatically resumes through the standby tunnel.
To monitor tunnel traffic, go to the Monitoring tab of the IPsec-VPN connection in the Alibaba Cloud console. See Monitor an IPsec-VPN connection.
What's next
-
Monitor an IPsec-VPN connection — Set up monitoring and alerts for tunnel health.
-
Create and manage a VPN Gateway instance — Manage your VPN Gateway after setup.
-
Configure IPsec-VPN connections — Modify tunnel encryption parameters.