Yes, applications deployed in a VPC can call APIs by default. If domain name resolution fails, configure a DNS server on the current endpoint by following the instructions in Configuring an Intranet DNS Server. After the configuration, applications deployed in the VPC can call APIs.
To configure a DNS server, specify its IP address in the /etc/resolv.conf file.
The IP address of the intranet DNS server depends on which region you are located in. Find the IP address of the intranet DNS server in your region from the private DNS server addresses mentioned in the Domain Name Service FAQs.
Add an intranet DNS server with either of the following two methods:
The intranet DNS server configurations become invalid after the ECS restarts, and the intranet DNS server must be configured again. Therefore, method 1 is recommended.
Perform the following procedure to add a DNS server IP address to the subnet configurations of the ECS in the VPC.
For example, change the address to 100.125.1.250.
The following figure shows the IP address 100.125.1.250 of the DNS server to be configured.
Modifying the subnet information of a VPC will affect all ECSs created using the subnet.
Add the IP address of the intranet DNS server to the /etc/resolv.conf file.
For example, if you are located in region01, add an intranet DNS server of IP address 100.125.1.250 to the /etc/resolv.conf file.