Using a VPC Peering Connection to Connect Two VPCs
You can configure a VPC peering connection and set the destination of the routes added to VPC route tables to the peer VPC CIDR block. In this way, all resources in the two VPCs are connected. Table 1 shows example scenarios.
Scenario | Scenario Description | IP Address Version | Example |
---|---|---|---|
Two VPCs peered together | You have two VPCs that require full access to each other's resources. For example, your company has VPC-A for the human resource department, and VPC-B for the finance department. The two departments require full access to each other's resources. | IPv4 | |
IPv6 | |||
Multiple VPCs peered together | You have multiple VPCs that require access to each other's resources. For example, your company has VPC-A for the human resource department, VPC-B for the finance department, and VPC-C for the marketing department. These departments require full access to each other's resources. | IPv4 | |
IPv4 | |||
IPv6 | |||
One central VPC peered with two VPCs | You have a central VPC that requires access to two peer VPCs, and similarly, the peer VPCs require access to the central VPC. However, the two peer VPCs need to be isolated from each other. For example, public services (such as databases) are deployed on VPC-A. Both VPC-B and VPC-C need to access the databases, but they do not need to access each other. | IPv4 | |
IPv6 | |||
One central VPC with primary and secondary CIDR blocks peered with two VPCs | You have a central VPC that has both primary and secondary CIDR blocks. The central VPC needs to communicate with two peer VPCs, but the peer VPCs need to be isolated from each other. | IPv4 | |
One central VPC peered with multiple VPCs | You have a central VPC that requires access to the multiple peer VPCs, and similarly, the peer VPCs require access to the central VPC. However, the peer VPCs need to be isolated from each other. For example, public services (such as databases) are deployed on your central VPC-A. VPC-B, VPC-C, VPC-D, VPC-E, VPC-F, and VPC-G need to access the databases, but these VPCs do not need to access each other. | IPv4 | |
IPv6 |
Notes and Constraints
If you create a VPC peering connection that connects entire CIDR blocks of two VPCs, the VPC CIDR blocks cannot overlap. Otherwise, the VPC peering connection does not take effect. For details, see Invalid VPC Peering for Overlapping VPC CIDR Blocks.
Even if you intend to use the VPC peering connection for IPv6 communication only, you cannot create a VPC peering connection if the VPCs have matching or overlapping IPv4 CIDR blocks. In all examples in this section, the IPv4 CIDR blocks of any VPCs connected by a VPC peering connection do not overlap.
Two VPCs Peered Together (IPv4)
Create Peering-AB between VPC-A and VPC-B. The CIDR blocks of VPC-A and VPC-B do not overlap.
- For details about resource planning, see Table 2.
- For details about VPC peering relationships, see Table 3.
Figure 1 Networking diagram (IPv4)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 | 172.16.0.0/24 | rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server | 172.16.0.111 |
Subnet-A02 | 172.16.1.0/24 | rtb-VPC-A | ECS-A02 | 172.16.1.91 | |||
VPC-B | 10.0.0.0/16 | Subnet-B01 | 10.0.0.0/24 | rtb-VPC-B | ECS-B01 | 10.0.0.139 | |
Subnet-B02 | 10.0.1.0/24 | rtb-VPC-B | ECS-B02 | 10.0.1.167 |
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
After the VPC peering connection is created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.1.0/24 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
10.0.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop. |
If the destination of a route in a route table of a VPC is set to the CIDR block of a peer VPC and the CIDR blocks of the two VPCs do not overlap, the VPCs can have full access to each other's resources.
Two VPCs Peered Together (IPv6)
Create Peering-AB between VPC-A and VPC-B. The subnets of VPC-A and VPC-B have both IPv4 and IPv6 CIDR blocks and their IPv4 CIDR blocks do not overlap.
- For details about resource planning, see Table 5.
- For details about VPC peering relationships, see Table 6.
Figure 2 Networking diagram (IPv6)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 |
| rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server |
|
Subnet-A02 |
| rtb-VPC-A | ECS-A02 |
| |||
VPC-B | 10.0.0.0/16 | Subnet-B01 |
| rtb-VPC-B | ECS-B01 |
| |
Subnet-B02 |
| rtb-VPC-B | ECS-B02 |
|
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
After the VPC peering connection is created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c34::/64 | Local | System | ||
172.16.1.0/24 | Local | System | ||
2407:c080:802:c37::/64 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c35::/64 (Subnet-B01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-B01 and Subnet-B02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c38::/64 (Subnet-B02) | Peering-AB | Custom | ||
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c35::/64 | Local | System | ||
10.0.1.0/24 | Local | System | ||
2407:c080:802:c38::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AB | Custom |
You can view IPv6 addresses of VPC subnets on the management console. To enable communication between entire CIDR blocks of two VPCs, you need to add routes with IPv6 CIDR blocks of all subnets in the VPCs as the destinations one by one.
Multiple VPCs Peered Together (IPv4)
If multiple VPCs need to communicate with each other, their CIDR blocks cannot overlap and you need to create a VPC peering connection between every two VPCs.
- For details about resource planning, see Table 8.
- For details about VPC peering relationships, see Table 9.
Figure 3 Networking diagram (IPv4)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 | 172.16.0.0/24 | rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server | 172.16.0.111 |
Subnet-A02 | 172.16.1.0/24 | rtb-VPC-A | ECS-A02 | 172.16.1.91 | |||
VPC-B | 10.0.0.0/16 | Subnet-B01 | 10.0.0.0/24 | rtb-VPC-B | ECS-B01 | 10.0.0.139 | |
Subnet-B02 | 10.0.1.0/24 | rtb-VPC-B | ECS-B02 | 10.0.1.167 | |||
VPC-C | 192.168.0.0/16 | Subnet-C01 | 192.168.0.0/24 | rtb-VPC-C | ECS-C01 | 192.168.0.194 | |
Subnet-C02 | 192.168.1.0/24 | rtb-VPC-C | ECS-C02 | 192.168.1.200 |
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
VPC-B is peered with VPC-C. | Peering-BC | VPC-B | VPC-C |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.1.0/24 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
10.0.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-BC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-BC as the next hop. | |
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
192.168.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop. | |
10.0.0.0/16 (VPC-B) | Peering-BC | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-BC as the next hop. |
If the destination of a route in a route table of a VPC is set to the CIDR block of a peer VPC and the CIDR blocks of the two VPCs do not overlap, the VPCs can have full access to each other's resources.
Multiple VPCs Peered Together Through Transitive Peering Connections (IPv4)
VPC peering connections are transitive. As shown in Figure 4, there is a VPC peering connection between VPC-A and VPC-B, and between VPC-A and VPC-C. To enable communication between VPC-B and VP-C, you can use either of the following methods:
- Create a VPC peering connection between VPC-B and VPC-C. For details, see Multiple VPCs Peered Together (IPv4).
- Add routes to direct traffic between VPC-B and VPC-C based on VPC-A. For details, see Table 13.
Figure 4 Transitive VPC peering connections

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 | 172.16.0.0/24 | rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server | 172.16.0.111 |
Subnet-A02 | 172.16.1.0/24 | rtb-VPC-A | ECS-A02 | 172.16.1.91 | |||
VPC-B | 10.0.0.0/16 | Subnet-B01 | 10.0.0.0/24 | rtb-VPC-B | ECS-B01 | 10.0.0.139 | |
Subnet-B02 | 10.0.1.0/24 | rtb-VPC-B | ECS-B02 | 10.0.1.167 | |||
VPC-C | 192.168.0.0/16 | Subnet-C01 | 192.168.0.0/24 | rtb-VPC-C | ECS-C01 | 192.168.0.194 | |
Subnet-C02 | 192.168.1.0/24 | rtb-VPC-C | ECS-C02 | 192.168.1.200 |
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.1.0/24 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
10.0.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-AB | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AB as the next hop. | |
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
192.168.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop. | |
10.0.0.0/16 (VPC-B) | Peering-AC | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AC as the next hop. |
If the destination of a route in a route table of a VPC is set to the CIDR block of a peer VPC and the CIDR blocks of the two VPCs do not overlap, the VPCs can have full access to each other's resources.
Multiple VPCs Peered Together (IPv6)
If multiple VPCs need to communicate with each other, you need to create a VPC peering connection between every two VPCs. In this example, subnets in VPC-A, VPC-B, and VPC-C have IPv6 CIDR blocks and the IPv4 CIDR blocks of VPC-A, VPC-B, and VPC-C cannot overlap.
- For details about resource planning, see Table 14.
- For details about VPC peering relationships, see Table 15.
Figure 5 Networking diagram (IPv6)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 |
| rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server |
|
Subnet-A02 |
| rtb-VPC-A | ECS-A02 |
| |||
VPC-B | 10.0.0.0/16 | Subnet-B01 |
| rtb-VPC-B | ECS-B01 |
| |
Subnet-B02 |
| rtb-VPC-B | ECS-B02 |
| |||
VPC-C | 192.168.0.0/16 | Subnet-C01 |
| rtb-VPC-C | ECS-C01 |
| |
Subnet-C02 |
| rtb-VPC-C | ECS-C02 |
|
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
VPC-B is peered with VPC-C. | Peering-BC | VPC-B | VPC-C |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c34::/64 | Local | System | ||
172.16.1.0/24 | Local | System | ||
2407:c080:802:c37::/64 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c35::/64 (Subnet-B01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-B01 and Subnet-B02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c38::/64 (Subnet-B02) | Peering-AB | Custom | ||
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop for IPv4 communication. | |
2407:c080:802:c3c::/64 (Subnet-C01) | Peering-AC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-C01 and Subnet-C02 as the destinations and Peering-AC as the next hop for IPv6 communication. | |
2407:c080:802:c3d::/64 (Subnet-C02) | Peering-AC | Custom | ||
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c35::/64 | Local | System | ||
10.0.1.0/24 | Local | System | ||
2407:c080:802:c38::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AB | Custom | ||
192.168.0.0/16 (VPC-C) | Peering-BC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-BC as the next hop for IPv4 communication. | |
2407:c080:802:c3c::/64 (Subnet-C01) | Peering-BC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-C01 and Subnet-C02 as the destinations and Peering-BC as the next hop for IPv6 communication. | |
2407:c080:802:c3d::/64 (Subnet-C02) | Peering-BC | Custom | ||
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c3c::/64 | Local | System | ||
192.168.1.0/24 | Local | System | ||
2407:c080:802:c3d::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AC as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AC | Custom | ||
10.0.0.0/16 (VPC-B) | Peering-BC | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-BC as the next hop for IPv4 communication. | |
2407:c080:802:c35::/64 (Subnet-B01) | Peering-BC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-B01 and Subnet-B02 as the destinations and Peering-BC as the next hop for IPv6 communication. | |
2407:c080:802:c38::/64 (Subnet-B02) | Peering-BC | Custom |
You can view IPv6 addresses of VPC subnets on the management console. To enable communication between entire CIDR blocks of two VPCs, you need to add routes with IPv6 CIDR blocks of all subnets in the VPCs as the destinations one by one.
One Central VPC Peered with Two VPCs (IPv4)
Create Peering-AB between VPC-A and VPC-B, and Peering-AC between VPC-A and VPC-C. The three VPCs do not have overlapping CIDR blocks.
- For details about resource planning, see Table 17.
- For details about VPC peering relationships, see Table 18.
Figure 6 Networking diagram (IPv4)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 | 172.16.0.0/24 | rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server | 172.16.0.111 |
Subnet-A02 | 172.16.1.0/24 | rtb-VPC-A | ECS-A02 | 172.16.1.91 | |||
VPC-B | 10.0.0.0/16 | Subnet-B01 | 10.0.0.0/24 | rtb-VPC-B | ECS-B01 | 10.0.0.139 | |
Subnet-B02 | 10.0.1.0/24 | rtb-VPC-B | ECS-B02 | 10.0.1.167 | |||
VPC-C | 192.168.0.0/16 | Subnet-C01 | 192.168.0.0/24 | rtb-VPC-C | ECS-C01 | 192.168.0.194 | |
Subnet-C02 | 192.168.1.0/24 | rtb-VPC-C | ECS-C02 | 192.168.1.200 |
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.1.0/24 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
10.0.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop. | |
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
192.168.1.0/24 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop. |
If the destination of a route in a route table of a VPC is set to the CIDR block of a peer VPC and the CIDR blocks of the two VPCs do not overlap, the VPCs can have full access to each other's resources.
One Central VPC Peered with Two VPCs (IPv6)
Create Peering-AB between VPC-A and VPC-B, and Peering-AC between VPC-A and VPC-C. Each VPC has IPv6 subnets. The IPv4 CIDR blocks of the three VPCs do not overlap with each other.
- For details about resource planning, see Table 20.
- For details about VPC peering relationships, see Table 21.
Figure 7 Networking diagram (IPv6)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 |
| rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server |
|
Subnet-A02 |
| rtb-VPC-A | ECS-A02 |
| |||
VPC-B | 10.0.0.0/16 | Subnet-B01 |
| rtb-VPC-B | ECS-B01 |
| |
Subnet-B02 |
| rtb-VPC-B | ECS-B02 |
| |||
VPC-C | 192.168.0.0/16 | Subnet-C01 |
| rtb-VPC-C | ECS-C01 |
| |
Subnet-C02 |
| rtb-VPC-C | ECS-C02 |
|
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c34::/64 | Local | System | ||
172.16.1.0/24 | Local | System | ||
2407:c080:802:c37::/64 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c35::/64 (Subnet-B01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-B01 and Subnet-B02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c38::/64 (Subnet-B02) | Peering-AB | Custom | ||
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop for IPv4 communication. | |
2407:c080:802:c3c::/64 (Subnet-C01) | Peering-AC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-C01 and Subnet-C02 as the destinations and Peering-AC as the next hop for IPv6 communication. | |
2407:c080:802:c3d::/64 (Subnet-C02) | Peering-AC | Custom | ||
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c35::/64 | Local | System | ||
10.0.1.0/24 | Local | System | ||
2407:c080:802:c38::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AB | Custom | ||
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c3c::/64 | Local | System | ||
192.168.1.0/24 | Local | System | ||
2407:c080:802:c3d::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AC as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AC | Custom |
You can view IPv6 addresses of VPC subnets on the management console. To enable communication between entire CIDR blocks of two VPCs, you need to add routes with IPv6 CIDR blocks of all subnets in the VPCs as the destinations one by one.
One Central VPC with Primary and Secondary CIDR Blocks Peered with Two VPCs (IPv4)
Create Peering-AB between VPC-A and VPC-B, and Peering-AC between VPC-A and VPC-C. VPC-A has both primary and secondary CIDR blocks. The three VPCs do not have overlapping CIDR blocks.
- For details about resource planning, see Table 23.
- For details about VPC peering relationships, see Table 24.
Figure 8 Networking diagram (IPv4)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | Primary CIDR block: 172.16.0.0/16 | Subnet-A01 | 172.16.0.0/24 | rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server | 172.16.0.111 |
Secondary CIDR block: 192.167.0.0/16 | Subnet-A-Extend01 | 192.167.0.0/24 | rtb-VPC-A | ECS-A-Extend01 | 192.167.0.100 | ||
VPC-B | 10.0.0.0/16 | Subnet-B01 | 10.0.0.0/24 | rtb-VPC-B | ECS-B01 | 10.0.0.139 | |
VPC-C | 192.168.0.0/16 | Subnet-C01 | 192.168.0.0/24 | rtb-VPC-C | ECS-C01 | 192.168.0.194 |
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
192.167.0.0/24 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (Primary CIDR block of VPC-A) | Peering-AB | Custom | Add routes with the primary and secondary CIDR blocks of VPC-A as the destinations and Peering-AB as the next hop. | |
192.167.0.0/16 (Secondary CIDR block of VPC-A) | Peering-AB | Custom | ||
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (Primary CIDR block of VPC-A) | Peering-AC | Custom | Add routes with the primary and secondary CIDR blocks of VPC-A as the destinations and Peering-AC as the next hop. | |
192.167.0.0/16 (Secondary CIDR block of VPC-A) | Peering-AC | Custom |
If the destination of a route in a route table of a VPC is set to the CIDR block of a peer VPC and the CIDR blocks of the two VPCs do not overlap, the VPCs can have full access to each other's resources.
One Central VPC Peered with Multiple VPCs (IPv4)
Create a VPC peering connection between VPC-A and VPC-B, between VPC-A and VPC-C, between VPC-A and VPC-D, between VPC-A and VPC-E, between VPC-A and VPC-F, and between VPC-A and VPC-G. The CIDR blocks of these VPCs do not overlap.
- For details about resource planning, see Table 26.
- For details about VPC peering relationships, see Table 27.
Figure 9 Networking diagram (IPv4)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 | 172.16.0.0/24 | rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server | 172.16.0.111 |
Subnet-A02 | 172.16.1.0/24 | rtb-VPC-A | ECS-A02 | 172.16.1.91 | |||
VPC-B | 10.0.0.0/16 | Subnet-B01 | 10.0.0.0/24 | rtb-VPC-B | ECS-B01 | 10.0.0.139 | |
VPC-C | 192.168.0.0/16 | Subnet-C01 | 192.168.0.0/24 | rtb-VPC-C | ECS-C01 | 192.168.0.194 | |
VPC-D | 10.2.0.0/16 | Subnet-D01 | 10.2.0.0/24 | rtb-VPC-D | ECS-D01 | 10.2.0.237 | |
VPC-E | 10.3.0.0/16 | Subnet-E01 | 10.3.0.0/24 | rtb-VPC-E | ECS-E01 | 10.3.0.87 | |
VPC-F | 172.17.0.0/16 | Subnet-F01 | 172.17.0.0/24 | rtb-VPC-F | ECS-F01 | 172.17.0.103 | |
VPC-G | 10.4.0.0/16 | Subnet-G01 | 10.4.0.0/24 | rtb-VPC-G | ECS-G01 | 10.4.0.10 |
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
VPC-A is peered with VPC-D. | Peering-AD | VPC-A | VPC-D |
VPC-A is peered with VPC-E. | Peering-AE | VPC-A | VPC-E |
VPC-A is peered with VPC-F. | Peering-AF | VPC-A | VPC-F |
VPC-A is peered with VPC-G. | Peering-AG | VPC-A | VPC-G |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.1.0/24 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop. | |
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop. | |
10.2.0.0/16 (VPC-D) | Peering-AD | Custom | Add a route with the CIDR block of VPC-D as the destination and Peering-AD as the next hop. | |
10.3.0.0/16 (VPC-E) | Peering-AE | Custom | Add a route with the CIDR block of VPC-E as the destination and Peering-AE as the next hop. | |
172.17.0.0/16 (VPC-F) | Peering-AF | Custom | Add a route with the CIDR block of VPC-F as the destination and Peering-AF as the next hop. | |
10.4.0.0/16 (VPC-G) | Peering-AG | Custom | Add a route with the CIDR block of VPC-G as the destination and Peering-AG as the next hop. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop. | |
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop. | |
rtb-VPC-D | 10.2.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (VPC-A) | Peering-AD | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AD as the next hop. | |
rtb-VPC-E | 10.3.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (VPC-A) | Peering-AE | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AE as the next hop. | |
rtb-VPC-F | 172.17.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (VPC-A) | Peering-AF | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AF as the next hop. | |
rtb-VPC-G | 10.4.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
172.16.0.0/16 (VPC-A) | Peering-AG | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AG as the next hop. |
If the destination of a route in a route table of a VPC is set to the CIDR block of a peer VPC and the CIDR blocks of the two VPCs do not overlap, the VPCs can have full access to each other's resources.
One Central VPC Peered with Multiple VPCs (IPv6)
Create a VPC peering connection between VPC-A and VPC-B, between VPC-A and VPC-C, between VPC-A and VPC-D, between VPC-A and VPC-E, between VPC-A and VPC-F, and between VPC-A and VPC-G. Each VPC has IPv6 subnets. The IPv4 CIDR blocks of these VPCs do not overlap.
- For details about resource planning, see Table 29.
- For details about VPC peering relationships, see Table 30.
Figure 10 Networking diagram (IPv6)

VPC Name | VPC CIDR Block | Subnet Name | Subnet CIDR Block | Subnet Route Table | ECS Name | Security Group | Private IP Address |
---|---|---|---|---|---|---|---|
VPC-A | 172.16.0.0/16 | Subnet-A01 |
| rtb-VPC-A | ECS-A01 | sg-web: general-purpose web server |
|
Subnet-A02 |
| rtb-VPC-A | ECS-A02 |
| |||
VPC-B | 10.0.0.0/16 | Subnet-B01 |
| rtb-VPC-B | ECS-B01 |
| |
VPC-C | 192.168.0.0/16 | Subnet-C01 |
| rtb-VPC-C | ECS-C01 |
| |
VPC-D | 10.2.0.0/16 | Subnet-D01 |
| rtb-VPC-D | ECS-D01 |
| |
VPC-E | 10.3.0.0/16 | Subnet-E01 |
| rtb-VPC-E | ECS-E01 |
| |
VPC-F | 172.17.0.0/16 | Subnet-F01 |
| rtb-VPC-F | ECS-F01 |
| |
VPC-G | 10.4.0.0/16 | Subnet-G01 |
| rtb-VPC-G | ECS-G01 |
|
Peering Relationship | Peering Connection Name | Local VPC | Peer VPC |
---|---|---|---|
VPC-A is peered with VPC-B. | Peering-AB | VPC-A | VPC-B |
VPC-A is peered with VPC-C. | Peering-AC | VPC-A | VPC-C |
VPC-A is peered with VPC-D. | Peering-AD | VPC-A | VPC-D |
VPC-A is peered with VPC-E. | Peering-AE | VPC-A | VPC-E |
VPC-A is peered with VPC-F. | Peering-AF | VPC-A | VPC-F |
VPC-A is peered with VPC-G. | Peering-AG | VPC-A | VPC-G |
After the VPC peering connections are created, add the following routes to the route tables of the local and peer VPCs:
Route Table | Destination | Next Hop | Route Type | Description |
---|---|---|---|---|
rtb-VPC-A | 172.16.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c34::/64 | Local | System | ||
172.16.1.0/24 | Local | System | ||
2407:c080:802:c37::/64 | Local | System | ||
10.0.0.0/16 (VPC-B) | Peering-AB | Custom | Add a route with the CIDR block of VPC-B as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c35::/64 (Subnet-B01) | Peering-AB | Custom | Add a route with the IPv6 CIDR block of Subnet-B01 as the destination and Peering-AB as the next hop for IPv6 communication. | |
192.168.0.0/16 (VPC-C) | Peering-AC | Custom | Add a route with the CIDR block of VPC-C as the destination and Peering-AC as the next hop for IPv4 communication. | |
2407:c080:802:c3c::/64 (Subnet-C01) | Peering-AC | Custom | Add a route with the IPv6 CIDR block of Subnet-C01 as the destination and Peering-AC as the next hop for IPv6 communication. | |
10.2.0.0/16 (VPC-D) | Peering-AD | Custom | Add a route with the CIDR block of VPC-D as the destination and Peering-AD as the next hop for IPv4 communication. | |
2407:c080:802:c45::/64 (Subnet-D01) | Peering-AD | Custom | Add a route with the IPv6 CIDR block of Subnet-D01 as the destination and Peering-AD as the next hop for IPv6 communication. | |
10.3.0.0/16 (VPC-E) | Peering-AE | Custom | Add a route with the CIDR block of VPC-E as the destination and Peering-AE as the next hop for IPv4 communication. | |
2407:c080:802:c46::/64 (Subnet-E01) | Peering-AE | Custom | Add a route with the IPv6 CIDR block of Subnet-E01 as the destination and Peering-AE as the next hop for IPv6 communication. | |
172.17.0.0/16 (VPC-F) | Peering-AF | Custom | Add a route with the CIDR block of VPC-F as the destination and Peering-AF as the next hop for IPv4 communication. | |
2407:c080:802:c47::/64 (Subnet-F01) | Peering-AF | Custom | Add a route with the IPv6 CIDR block of Subnet-F01 as the destination and Peering-AF as the next hop for IPv6 communication. | |
10.4.0.0/16 (VPC-G) | Peering-AG | Custom | Add a route with the CIDR block of VPC-G as the destination and Peering-AG as the next hop for IPv4 communication. | |
2407:c080:802:c48::/64 (Subnet-G01) | Peering-AG | Custom | Add a route with the IPv6 CIDR block of Subnet-G01 as the destination and Peering-AG as the next hop for IPv6 communication. | |
rtb-VPC-B | 10.0.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c35::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AB | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AB as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AB | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AB as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AB | Custom | ||
rtb-VPC-C | 192.168.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c3c::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AC | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AC as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AC | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AC as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AC | Custom | ||
rtb-VPC-D | 10.2.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c45::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AD | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AD as the next hop for IPv4 communication. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AD | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AD as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AD | Custom | ||
rtb-VPC-E | 10.3.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c46::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AE | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AE as the next hop. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AE | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AE as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AE | Custom | ||
rtb-VPC-F | 172.17.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c47::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AF | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AF as the next hop. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AF | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AF as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AF | Custom | ||
rtb-VPC-G | 10.4.0.0/24 | Local | System | Local routes are automatically added for communications within a VPC. |
2407:c080:802:c48::/64 | Local | System | ||
172.16.0.0/16 (VPC-A) | Peering-AG | Custom | Add a route with the CIDR block of VPC-A as the destination and Peering-AG as the next hop. | |
2407:c080:802:c34::/64 (Subnet-A01) | Peering-AG | Custom | Add routes with the IPv6 CIDR blocks of Subnet-A01 and Subnet-A02 as the destinations and Peering-AG as the next hop for IPv6 communication. | |
2407:c080:802:c37::/64 (Subnet-A02) | Peering-AG | Custom |
You can view IPv6 addresses of VPC subnets on the management console. To enable communication between entire CIDR blocks of two VPCs, you need to add routes with IPv6 CIDR blocks of all subnets in the VPCs as the destinations one by one.
- Notes and Constraints
- Two VPCs Peered Together (IPv4)
- Two VPCs Peered Together (IPv6)
- Multiple VPCs Peered Together (IPv4)
- Multiple VPCs Peered Together Through Transitive Peering Connections (IPv4)
- Multiple VPCs Peered Together (IPv6)
- One Central VPC Peered with Two VPCs (IPv4)
- One Central VPC Peered with Two VPCs (IPv6)
- One Central VPC with Primary and Secondary CIDR Blocks Peered with Two VPCs (IPv4)
- One Central VPC Peered with Multiple VPCs (IPv4)
- One Central VPC Peered with Multiple VPCs (IPv6)