IP addresses are used to connect to Elastic Compute Service (ECS) instances or services deployed on ECS instances. Two types of IP addresses can be assigned to ECS instances in virtual private clouds (VPCs): private IP addresses and public IP addresses.
Private IP addresses
Each new ECS instance in a VPC is assigned a private IP address based on the CIDR block of the VPC and the CIDR block of the vSwitch to which the instance is connected.
- Load balancing
- Communication over the internal network between ECS instances within the same VPC
- Communication over the internal network between an ECS instance and other cloud services such as Object Storage Service (OSS) and ApsaraDB RDS within the same VPC
Public IP addresses
- PublicIP addresses: the public IP addresses assigned by ECS.
- Elastic IP addresses (EIPs). For more information, see EIPs .
The following table describes the major differences between the two types of public IP addresses.
|Scenario||If you want an instance to have a public IP address that will not be retained when the instance is released, you can configure a PublicIP address to be automatically assigned when you create the instance.||If you want to retain a public IP address after its associated instance is released for use with other ECS instances, use an EIP. Each EIP can be associated with or disassociated from different ECS instances. After an instance is released, its associated EIP is retained.|
|Description||If you select Assign Public IPv4 Address when you create an ECS instance, a PublicIP address is assigned to the instance.||After an EIP is created, it can be associated with an ECS instance that is not assigned a PublicIP address. For more information, see Apply for an EIP and Associate an EIP with an instance.|
|Maximum number of IP addresses that can be assigned to or associated with a single ECS instance||Only a single PublicIP address can be assigned to each ECS instance.||Multiple EIPs can be associated with a single ECS instance in multi-EIP-to-ENI mode. For more information, see Associate EIPs with secondary ENIs in multi-EIP-to-ENI mode (new applications are not accepted).|
|Method to disassociate an IP address||After a PublicIP address is assigned to an ECS instance, the address can only be released along with the instance but cannot be disassociated from the instance. You can convert PublicIP addresses into EIPs as needed. EIPs can be associated with or disassociated from ECS instances at any time. For more information, see Convert the public IP address of a VPC-type instance to an EIP.||EIPs can be disassociated from ECS instances. For more information, see Disassociate an EIP from an instance.|
|Method to release an IP address||
||For more information, see Release a pay-as-you-go EIP.|
|Method to view a media access control (MAC) address||ECS instances in VPCs are connected to the Internet by using the mapping of public IP addresses to internal network interface controllers (NICs). Therefore, the public NICs of ECS instances in VPCs cannot be discovered from within the instances regardless of whether the instances are assigned PublicIP addresses or associated with EIPs.|
You are charged only for outbound traffic to the Internet. For more information, see Public bandwidth.