Before creating your VPCs, determine how many VPCs, the number of subnets, and what IP address ranges or connectivity options you will need.


How Do I Determine How Many VPCs I Need?

VPCs are region-specific. By default, networks in VPCs in different regions or even in the same region are not connected. The network communications on these different networks are completely isolated from each other, this is not the case for different AZs in the same VPC. Two networks on the same VPC should be able to communicate with each other even if they are in different AZs.

One VPC

If your services do not require network isolation, a single VPC should be enough.

Multiple VPCs

If you have multiple service systems in a region and each service system requires an isolated network, you can create a separate VPC for each service system. If you require network connectivity between separate VPCs, you can use a VPC peering connection as shown in figure 1.


Figure 1 VPC peering connection

Default VPC Quota

By default, you can create a maximum of five VPCs in your cloud account. If this cannot meet your service requirements, submit a service ticket to request a quota increase.

How Do I Plan Subnets?

A subnet is a range of IP addresses in your VPC. All of the resources in a VPC must be deployed on subnets and the subnets on a VPC cannot overlap. Once a subnet has been created, its CIDR block (the IP address range) cannot be modified.

The subnets used to deploy your resources must reside within your VPC's network, and the subnet masks used to define them can be between the netmask of its VPC CIDR block and /28 netmask.

  • 10.0.0.0/8~24
  • 172.16.0.0/12~24
  • 192.168.0.0/16~24

Subnet Planning

  • We recommend that you create different subnets for different service modules in a VPC. For example, you can create different subnets for web, application, and database servers. The web server is in a publicly accessible subnet, and application and database servers are in non-publically accessible subnets. You can leverage network ACLs to help control access to the servers in each subnet.
  • If you only need to plan subnets for VPCs, and communication between VPCs and IDCs are not required, you can create subnets within any of the CIDR blocks listed in the preceding table.
  • If your VPC needs to communicate with an on-premises IDC through a VPN or Direct Connect connection, the VPC CIDR block cannot overlap with your IDC CIDR block. Therefore, when creating a VPC or subnet, ensure that the new CIDR block does not overlap with any CIDR block on your IDC.
  • When determining the size of a VPC or subnet CIDR block, ensure that the number of available IP addresses on the CIDR block meet your service requirements.

Default Subnet Quota

By default, you can create up to 100 subnets in your cloud account. If you need more, submit a service ticket to request a quota increase.


How Do I Plan Routing Policies?

A route table contains a set of rules, called routes, that are used to control where inbound and outbound subnet traffic is forwarded within a VPC. When you create a VPC, it automatically has a default route table, which enables internal communication within that VPC.

  • If you do not need to explicitly control how each subnet routes inbound and outbound traffic, you can use the default route table and do not configure custom routes.
  • If you need to explicitly control how each subnet routes inbound and outbound traffic in a VPC, you can add custom routes to the route table.

How Do I Connect to an On-Premises IDC

If you require interconnection between a VPC and an on-premises IDC, ensure that the VPC does not have a matching or overlapping IP address range with the on-premises IDC to be connected.

In Figure 2, VPC 1 is in North China region and VPC 2 and VPC 3 are in East China region. To connect to an on-premises IDC, they can use a VPN, as VPC 1 is doing in Beijing; or a Direct Connect connection, as VPC 2 does in Shanghai. VPC 2 connects to the data center through a Direct Connect connection, but to connect to another VPC in that region, like VPC 3, a VPC peering connection must be established.

Figure 2 Connections to on-premises IDCs

When planning CIDR blocks for VPC 1, VPC 2, and VPC 3.

  • The CIDR block of VPC 1 cannot overlap with the CIDR blocks of the user IDC in Beijing.
  • The CIDR block of VPC 2 cannot overlap with the CIDR blocks of the IDC in Shanghai.
  • The CIDR blocks of VPC 2 and VPC 3 cannot overlap.

How Do I Access the Internet?

Use EIPs to enable a small number of ECSs to access the Internet.

When only a few ECSs need to access the Internet, you can bind the EIPs to the ECSs. This will provide them with Internet access. You can also dynamically unbind the EIPs from the ECSs and bind them to NAT gateways and load balancers instead, which will also provide Internet access. The process is not complicated.

For more information about EIP, see EIP Overview.

Use NAT gateways to enable a large number of ECSs to access the Internet.

When a large number of ECSs need to access the Internet, the public cloud system provides network address translation (NAT) gateways for your ECSs. With NAT gateways, you do not need to assign an EIP to each ECS. NAT gateways reduce costs as you do not need so many EIPs. A NAT gateway offers both source network address translation (SNAT) and destination network address translation (DNAT). SNAT allows multiple ECSs in the same VPC to share one or more EIPs to access the Internet. SNAT saves money and prevents the EIPs of ECSs from being exposed to the Internet. DNAT can implement port-level data forwarding. It maps EIP ports to ECS ports so that the ECSs in a VPC can share the same EIP and bandwidth and provide Internet-accessible services.

For more information about NAT Gateway, see NAT Gateway User Guide.

Use ELB to access the Internet If there are a large number of highly concurrent requests.

In high-concurrency scenarios, such as e-commerce, you can use load balancers provided by the ELB service to evenly distribute access traffic across multiple ECSs, allowing a large number of users to concurrently access your business system or application. ELB is deployed in clusters. It provides fault tolerance for your applications by automatically balancing traffic across multiple availability zones (AZs). You can also take advantage of deep integration with Auto Scaling (AS), which enables automatic scaling based on service traffic and ensures service stability and reliability.

For instructions about how to create a load balancer, see Elastic Load Balance User Guide.