After a private zone is added, the private zone record does not immediately override the public network record. The private zone record will only override the existing public network record after you associate the private zone with a VPC and only when a user queries the private domain from within the VPC.
- Add a private zone to taobao.com.
Before you associate the private zone with a VPC, no DNS records are created for the zone. The DNS resolver still returns the IP address in the public DNS record when www.taobao.com is resolved.
- Add records to the private zone
Before you can associate the private zone with a VPC, you must add records for the zone. This prevents any ongoing DNS query from being disrupted when an empty private zone is associated with a VPC.
Therefore, you must add records for the domain names in a private zone before associating the private zone with a VPC.
- Associate the private zone with a VPC
Associate the private zone that an ECS instance accesses with the VPC in which the ECS instance resides. The private zone record will then override the public network record.
For example, the record for the private zone “www.taobao.com” is set to
www.taobao.com A 60 22.214.171.124.
Then if a ping command is run on the ECS instance in the VPC, the domain name www.taobao.com is resolved to 126.96.36.199. The IP address to which www.taobao.com is resolved in the public networks is overridden.