Updated on 2022-01-25 GMT+08:00

Routing Traffic Within a VPC

Scenarios

If you have deployed ECSs and other cloud services on the cloud, you can configure private domain names for the ECSs so that they can communicate with each other or access cloud services using over a private network.

You can create any private zones for domain names that are unique within VPCs. You do not need to register the domain names.

This section describes how to create a private zone and add an A record set to it.

Prerequisites

You have created an ECS and obtained its VPC name and private IP address.

Procedure

Figure 1 shows the process for configuring a private zone for a domain name.

Figure 1 Process for configuring a private zone

Step 1. Create a Private Zone

Create a private zone to allow access to your ECS using a private domain name.

  1. Log in to the management console.
  2. In the service list, choose Network > Domain Name Service.

    The DNS console is displayed.

  3. In the navigation pane, choose Private Zones.

    The Private Zones page is displayed.

  4. Click in the upper left corner and select the desired region and project.
  5. Click Create Private Zone.
  6. Set Name to example.com and select the VPC where the ECS resides.

    For details about more parameters, see Creating a Private Zone.

  7. Click OK.
  8. Switch back to the Private Zones page.
    View the created private zone.

    Click the zone name to view zone details. You can view SOA and NS record sets automatically generated by the system.

    • The SOA record set defines the DNS server that is the authoritative information source for a particular domain name.
    • The NS record set defines authoritative DNS servers for a domain name.

Step 2. Add an A Record Set

To access the ECS using example.com, add an A record set.

  1. On the Private Zones page, click the name of the private zone you created.

    The Record Sets page is displayed.

  2. Click Add Record Set.
  3. Set the parameters as follows:
    • Name: Leave this parameter blank. The system automatically considers example.com to be the name, and requests are routed to example.com.
    • Type: Set it to A – Map domains to IPv4 addresses.
    • Value: Enter the private IP address of the ECS.

    Retain the default values for other parameters. For details, see Adding an A Record Set.

  4. Click OK.
  5. Switch back to the Record Sets page.

    View the added record set in the record set list of the zone and ensure that the status of the record set is Normal.

Step 3. (Optional) Configure DNS Servers for the VPC Subnet

To ensure that the private domain name can be resolved in a VPC, change the DNS servers for the VPC subnet to those provided by the DNS service.

Query the private DNS servers provided by the DNS service

  1. Log in to the management console.
  2. In the service list, choose Network > Domain Name Service.

    The DNS console is displayed.

  3. In the navigation pane, choose Private Zones.

    The Private Zones page is displayed.

  4. Click in the upper left corner and select the desired region and project.
  5. In the private zone list, click the name of the zone and view the DNS servers.

Change the DNS servers

  1. Go to the private zone list.
  2. Click the VPC name under Associated VPC.

    On the VPC console, change the DNS servers of the VPC subnet.

    For details, see "Modifying a Subnet" in the Virtual Private Cloud User Guide.