All Products
Search
Document Center

Cloud Enterprise Network:Connect VPCs across accounts

Last Updated:Aug 25, 2026

Add VPCs from different Alibaba Cloud accounts to the same CEN instance to enable cross-account network connectivity.

Scenario

Suppose you have two Alibaba Cloud accounts:

  • Account A: has two VPCs (VPC1 and VPC2) and one CEN (CEN1).

  • Account B has a VPC (VPC3).

VPC1 and VPC2 are already attached to CEN1 and can communicate with each other, as described in Communication between VPCs in the same region.

The goal is to attach VPC3 to CEN1 so all three VPCs can communicate.

image

Network plan for the three VPCs:

Parameter

VPC1

VPC2

VPC3

Account

Account A

Account A

Account B

Region

China (Hangzhou)

China (Hangzhou)

China (Hangzhou)

IPv4 CIDR block

10.0.0.0/16

172.16.0.0/16

192.168.0.0/16

vSwitch 1

In availability zone J, with CIDR block 10.0.0.0/24

In availability zone J, with CIDR block 172.16.0.0/24

In availability zone J, with CIDR block 192.168.0.0/24

vSwitch 2

In availability zone K, with CIDR block 10.0.1.0/24

In availability zone K, with CIDR block 172.16.1.0/24

In availability zone K, with CIDR block 192.168.1.0/24

ECS instance IP

ECS1: 10.0.0.1

ECS2: 172.16.0.1

ECS3: 192.168.0.1

Important

When planning your network:

  • VPC CIDR blocks must not overlap. If they do, migrate resources to VPCs with non-overlapping CIDR blocks.

  • For zone-level disaster recovery, create vSwitches in at least two availability zones.

The steps in this guide apply to any valid IPv4 CIDR block, including non-RFC 1918 ranges such as 8.x.x.x and 121.x.x.x. The example scenario uses 10.0.0.0/16, 172.16.0.0/16, and 192.168.0.0/16, but the procedure works regardless of which CIDR blocks your VPCs use. The only requirement is that the CIDR blocks of the VPCs you want to connect must not overlap.

Procedure

This is a two-step process:

  • Log on to Account B and grant Account A authorization to attach VPC3 to CEN1.

  • Log on to Account A and attach VPC3 to CEN1.

Step 1: Grant authorization from Account B to Account A

  1. Log on to the VPC console with Account B.

  2. Click the instance ID of VPC3, go to the Cross-account Authorization tab, and click Cross-account Authorization. Configure the following settings:

    • Peer Account UID : Enter the ID of Account A (the main account).

      How do I find an Alibaba Cloud account ID?

      Hover over your profile picture in the upper-right corner of the console:

      • Main account: Click your account name in the upper-right corner, find Account ID in the dropdown, and click the copy icon.

      • RAM user: Click your username in the upper-right corner. The Main Account ID appears in the dropdown.

    • Peer CEN Instance ID: Enter the instance ID of the CEN instance CEN1 to which VPC1 and VPC2 in Account A are attached.

    • Payer: For this tutorial, select the default, CEN Instance Owner.

Step 2: Attach VPC3 to CEN1 from Account A

  1. Log on to the CEN console with Account A.

  2. Click the instance ID of CEN1, find the transit router for the China (Hangzhou) region, and in the Actions column, click Create Connection > Create Intra-Region Connection.

  3. On the Create Intra-Region Connection page, configure these settings:

    • Network Type: Select VPC.

    • Region: Select China (Hangzhou).

    • Account: Select Another Account, and enter the Alibaba Cloud account ID of Account B (VPC3 belongs to Account B).

    • Attachment Name: Enter attach3.

    • Networks: Select the instance ID for VPC3.

      If the dropdown is empty, cross-account authorization for VPC3 to CEN1 is not configured. Verify that the Peer Account UID is Account A's ID and the Peer CEN Instance ID is CEN1's instance ID.
    • VSwitch: The system automatically selects two vSwitches in VPC3.

      The system automatically selects vSwitches from two availability zones for disaster recovery. If VPC3 has vSwitches in only one zone, create one in a different zone first.
    • Advanced Settings: Keep the defaults. These settings are explained in How routing works.

Verify the connection

  1. Ensure that the security group rules for all three ECS instances allow inbound ICMP traffic.

  2. Log on to ECS3 in Account B and run ping to reach ECS1:

    ping 10.0.0.1
    [root@iZbp xxx ~]# ping 10.0.0.1
    PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
    64 bytes from 10.0.0.1: icmp_seq=1 ttl=63 time=0.580 ms
    64 bytes from 10.0.0.1: icmp_seq=2 ttl=63 time=0.421 ms
    64 bytes from 10.0.0.1: icmp_seq=3 ttl=63 time=0.281 ms
    64 bytes from 10.0.0.1: icmp_seq=4 ttl=63 time=0.295 ms
    64 bytes from 10.0.0.1: icmp_seq=5 ttl=63 time=0.296 ms
    64 bytes from 10.0.0.1: icmp_seq=6 ttl=63 time=0.247 ms
    64 bytes from 10.0.0.1: icmp_seq=7 ttl=63 time=0.269 ms

    A successful ping confirms that VPC3 and VPC1 can communicate. Run ping 172.16.0.1 to verify connectivity between VPC3 and VPC2.

Routing

When the VPC attachment is created, the system automatically configures routing based on three advanced features enabled by default:

Three options are enabled by default: Associate with default route table of transit router (associates the VPC connection with the transit router's default route table), Propagate system routes to default route table of transit router (advertises VPC system routes to the transit router, enabling communication with other attached network instances), and Automatically create route that points to transit router and add to all route tables of current VPC (adds three routes — 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — to all VPC route tables, with next hops pointing to the transit router; by default, transit routers do not advertise routes to VPCs). To customize routing, clear these checkboxes and configure route associations and propagation manually. See Route management.

Note

For IPv6 traffic, after creating the VPC connection, enable route synchronization or manually add IPv6 route entries pointing to the VPC connection in the VPC.

TR default route table

Destination CIDR block

Next hop

Route type

10.0.0.0/24

attach1

Propagated

10.0.1.0/24

attach1

Propagated

172.16.0.0/24

attach2

Propagated

172.16.1.0/24

attach2

Propagated

192.168.0.0/24

attach3

Propagated

192.168.1.0/24

attach3

Propagated

VPC1 system route table

Destination CIDR block

Next hop

Route type

10.0.0.0/24

Local

System

10.0.1.0/24

Local

System

10.0.0.0/8

attach1

Custom

172.16.0.0/12

attach1

Custom

192.168.0.0/16

attach1

Custom

VPC2 system route table

Destination CIDR block

Next hop

Route type

172.16.0.0/24

Local

System

172.16.1.0/24

Local

System

10.0.0.0/8

attach2

Custom

172.16.0.0/12

attach2

Custom

192.168.0.0/16

attach2

Custom

VPC3 system route table

Destination CIDR block

Next hop

Route type

192.168.0.0/24

Local

System

192.168.1.0/24

Local

System

10.0.0.0/8

attach3

Custom

172.16.0.0/12

attach3

Custom

192.168.0.0/16

attach3

Custom

FAQ

Connecting cross-region and cross-account VPCs

The process is similar to Connect VPCs across regions, except the VPCs belong to different accounts. Complete cross-account authorization (Step 1) before creating the attachment.

Partial connectivity and network isolation

Use multiple transit router route tables to isolate VPC1 and VPC2 while allowing both to communicate with VPC3. Isolate VPCs and enable access to shared services.