ECSs in the same VPC can communicate with each other using hostnames. In such a case, you are required to configure the mapping between hostnames and IP addresses. The communication using hostnames is more convenient than that using IP addresses.
This method applies only to Linux ECSs.
For example, there are two ECSs in a VPC, ecs-01 and ecs-02. Perform the following operations to enable communication using hostnames between ecs-01 and ecs-02:
For example, the obtained private IP addresses are as follows:
For example, the obtained hostnames are as follows:
sudo su -
Private IP address hostname
For example, add the following statement:
Log in to an ECS in the same VPC, run the following command to ping the added host, and check whether the operation is successful: