Help Center> Cloud Connect> Best Practices> Connecting VPCs of the Same Type in Different Regions by Using Cloud Connect and VPC Peering

Connecting VPCs of the Same Type in Different Regions by Using Cloud Connect and VPC Peering

Scenarios

This practice provides detailed operations for combining VPC Peering and Cloud Connect to enable communications between VPCs of the same service in different regions.

As shown in the following figure, there are three VPCs in CN East-Shanghai1 and CN South-Guangzhou, respectively. The three VPCs in each region are a production VPC, an office VPC, and a transit VPC, and they need to be connected as follows:

  • The production VPC in CN East-Shanghai1 communicates with the production VPC in CN South-Guangzhou.
  • The office VPC in CN East-Shanghai1 communicates with the office VPC in CN South-Guangzhou.
  • The production VPCs and the office VPC cannot communicate with each other.
Figure 1 Networking diagram
Table 1 Service configuration

Cloud Service

Scenario

Description

Related Operations

VPC Peering

Two VPCs are in the same region.

Create a VPC peering connection to connect two VPCs in the same region. The two VPCs can be in your account or in different accounts.

Creating a VPC Peering Connection to Connect Another VPC in Your Account

Creating a VPC Peering Connection to Connect a VPC in Another Account

Cloud Connect

VPCs are in different regions.

Connect a cloud connection to connect the VPCs across regions. The VPCs can be in the same account or in different accounts.

Communications Between VPCs Across Regions

To connect the VPCs using Cloud Connect and VPC Peering, ensure that the subnets in the VPCs do not overlap or conflict.

Prerequisites

  • You have registered a HUAWEI CLOUD account and completed real-name authentication.
  • Your account balance is sufficient to purchase the required resources, including bandwidth packages and ECSs.
  • You have created the VPCs and subnets that need to communicate with each other.

Procedure

  1. Configure VPC Peering.

    1. Create a VPC peering connection.
      1. Log in to the management console.
      2. Click in the upper left corner to select a region and a project.
      3. Hover on to display Service List and choose Networking > Virtual Private Cloud.
      4. In the navigation pane on the left, choose VPC Peering.
      5. In the upper right corner, click Create VPC Peering Connection.
      6. Configure the parameters based on Table 2. Select My account for Account.
        Figure 2 Creating a VPC peering connection
      Table 2 Parameter description

      Parameter

      Description

      Example Value

      Name

      Specifies the name of the VPC peering connection.

      The name contains a maximum of 64 characters, which consist of letters, digits, hyphens (-), and underscores (_).

      Production VPC peering in Shanghai1

      Local VPC

      Specifies one VPC you want to connect over the VPC peering connection. You can select one from the drop-down list.

      Transit VPC in Shanghai1

      Local VPC CIDR Block

      Specifies the CIDR block for the local VPC.

      192.168.1.0/24

      Account

      Specifies the account that owns the peer VPC.

      • My account: The VPC peering connection will be created between two VPCs, in the same region, in your account.
      • Another account: The VPC peering connection will be created between your VPC and a VPC in another account, in the same region.

      My account

      Peer Project

      Specifies the peer project name. The project name of the current project is used by default.

      cn-east-3

      Peer VPC

      Specifies another VPC you want to connect over the VPC peering connection. You can select one from the drop-down list if the VPC peering connection is created between two VPCs in your own account.

      Production VPC in Shanghai1

      Peer VPC CIDR Block

      Specifies the CIDR block for the peer VPC.

      The local and peer VPCs cannot have matching or overlapping CIDR blocks. Otherwise, the routes added for the VPC peering connection may not take effect.

      10.0.0.0/24

      Description

      (Optional) Provides supplementary information about the VPC peering connection.

      The description can contain a maximum of 255 characters and cannot contain angle brackets (<>).

      -

      1. Click OK.
    2. Add routes for the VPC peering connection.

      If you request a VPC peering connection with another VPC in your own account, the system automatically accepts the request. However, to enable communications between the two VPCs, you need to add local and peer routes on the Route Tables page for the VPC peering connection.

      1. Log in to the management console.
      2. Click in the upper left corner to select a region and a project.
      3. Hover on to display Service List and choose Networking > Virtual Private Cloud.
      4. In the navigation pane on the left, choose Route Tables.
      5. Search for or create a route table for the local VPC and add the local route. Table 3 describes the parameters.
        Figure 3 Adding local route
        Table 3 Parameter description

        Parameter

        Description

        Example Value

        Destination

        Specifies the CIDR block for the peer VPC.

        10.0.0.0/24

        Next Hop Type

        Specifies the next hop type. Select VPC peering connection.

        VPC peering connection

        Next Hop

        Specifies the next hop address. Select the name of the current VPC peering connection.

        Production VPC peering in Shanghai1

        Description

        (Optional) Provides supplementary information about the route.

        The description can contain a maximum of 255 characters and cannot contain angle brackets (<>).

        -

      6. Search for or create a route table for the peer VPC and add the peer route.
        Figure 4 Adding peer route
        Table 4 Parameter description

        Parameter

        Description

        Example Value

        Destination

        Specifies the CIDR block for the peer VPC.

        172.16.0.0/24

        Next Hop Type

        Specifies the next hop type. Select VPC peering connection.

        VPC peering connection

        Next Hop

        Specifies the next hop address. Select the current VPC peering connection.

        Production VPC peering in Shanghai1

        Description

        (Optional) Provides supplementary information about the route.

        The description can contain a maximum of 255 characters and cannot contain angle brackets (<>).

        -

      7. Repeat the above steps to create a VPC peering connection between the office VPC and the transit VPC in CN East-Shanghai1 and add local and peer routes.

        Repeat the above operations to create two VPC peering connections in CN South-Guangzhou, with one connecting the production VPC to the transit VPC and the other connecting the office VPC to the transit VPC.

        In the above steps, you can visit the route table module directly from the navigation pane on the left.

  1. Configure Cloud Connect.

    1. Create a cloud connection.
      1. Log in to the management console.
      2. Hover on to display Service List and choose Networking > Cloud Connect.
        Figure 5 Cloud Connect
      3. In the navigation pane on the left, choose Cloud Connect > Cloud Connections.
      4. On the displayed page, click Create Cloud Connection.
        Figure 6 Create Cloud Connection
      5. Configure the parameters based on Table 5.
        Table 5 Parameter description

        Parameter

        Description

        Example Value

        Name

        Specifies the cloud connection name.

        The name can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

        CloudConnect

        Enterprise Project

        Provides a cloud resource management mode, in which cloud resources and members are centrally managed by project.

        default

        Description

        Provides supplementary information about the cloud connection.

        The description can contain a maximum of 255 characters.

        A Cloud Connect instance for demo

      6. Click OK.
    2. Load network instances.

      Load the transit VPC in CN East-Shanghai1 to the created cloud connection.

      1. In the cloud connection list, click the cloud connection named CloudConnect.

        On the displayed page, you can view details about the cloud connection, such as its name, ID, status, time when the cloud connection was created, and description. There are also four tabs: Network Instances, Bound Bandwidth Packages, Inter-Region Bandwidths, and Route Information.

        Figure 7 Cloud connection details
      1. Under Network Instances, click Load Network Instance.
        Figure 8 Load Network Instance
      1. Configure the parameters.
        Figure 9 Loading a network instance
        Figure 10 Network instance details

        To communicate with the production VPC and the office VPC in CN East-Shanghai1, you need to set the CIDR blocks of the two VPCs as custom CIDR blocks.

      2. Click OK.
      3. Repeat the above steps to load the transit VPC in CN South-Guangzhou to the cloud connection and set the CIDR block of the production VPC and the CIDR block of the office VPC in CN South-Guangzhou as custom CIDR blocks.
        Figure 11 Loading another VPC

        After the VPCs are loaded, they are on the same network, and you can view the routes of each VPC on the Route Information tab page.

    3. Buy a bandwidth package.

      By default, the system allocates 10 kbit/s of bandwidth for testing network connectivity across regions.

      To ensure normal network communications, you need to purchase a bandwidth package and bind the package to the cloud connection.

      1. In the cloud connection list, click the cloud connection named CloudConnect.
      2. On the details page of the cloud connection, click Bound Bandwidth Packages and then Buy Bandwidth Package.
        Figure 12 Buy Bandwidth Package
      1. Configure the parameters.

        Because the two VPCs are in the Chinese mainland, select Single Geographic Region for Applicability and Chinese mainland for Geographic Region.

        Figure 13 Buying a bandwidth package
      1. Click Buy Now.
      2. Confirm the information and click Pay Now.
      3. Click Pay.

        Go back to the bandwidth package list and locate the bandwidth package. If its status changes to Normal, you can bind the bandwidth package to a cloud connection.

        On the Bandwidth Packages page, you can view the purchased bandwidth package and its details, including the billing mode, order information, the cloud connection it is bound to, used bandwidth, and remaining bandwidth. You can also modify, unbind, renew, and unsubscribe from the bandwidth package.

    4. Assign inter-region bandwidth.

      Assign bandwidth from the purchased bandwidth package for network communications between the VPCs.

      1. In the cloud connection list, click the cloud connection named CloudConnect.
      2. On the details page of the cloud connection, click Inter-Region Bandwidths and then Assign Inter-Region Bandwidth.
        Figure 14 Assigning inter-region bandwidth
      3. Configure the parameters.

        Select CN South-Guangzhou and CN East-Shanghai1 for Regions. The system automatically displays the bandwidth package bound to the cloud connection. Set the bandwidth based on your requirements, for example, 1 Mbit/s.

      4. View the assigned bandwidth on the Inter-Region Bandwidths tab page.

Verification

  • Check the route table of the transit VPC in CN East-Shanghai1.
    Figure 15 Route table of the transit VPC in CN East-Shanghai1
  • Check the route table of the production VPC in CN East-Shanghai1.
    Figure 16 Route table of the production VPC in CN East-Shanghai1
  • Check the route table of the office VPC in CN East-Shanghai1.
    Figure 17 Route table of the office VPC in CN East-Shanghai1
  • Check the route table of the transit VPC in CN South-Guangzhou.
    Figure 18 Route table of the transit VPC in CN South-Guangzhou
  • Check the route table of the production VPC in CN South-Guangzhou.
    Figure 19 Route table of the production VPC in CN South-Guangzhou
  • Check the route table of the office VPC in CN South-Guangzhou.
    Figure 20 Route table of the office VPC in CN South-Guangzhou
  • Ping an ECS in the production VPC in CN South-Guangzhou from an ECS in the production VPC in CN East-Shanghai1.
    Figure 21 Pinging two ECSs
  • Ping an ECS in the office VPC in CN South-Guangzhou from an ECS in the office VPC in CN East-Shanghai1.
    Figure 22 Pinging two ECSs