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 within virtual private clouds (VPCs): private IP addresses and public IP addresses.

Private IP addresses

Each new ECS instance within 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. Private IP addresses can be used in the following scenarios:
  • Load balancing
  • Communication between ECS instances within the same VPC over the internal network
  • Communication between an ECS instance and other cloud services such as Object Storage Service (OSS) and ApsaraDB RDS within the same VPC over the internal network

You can use the ECS console to modify private IP addresses. For more information, see Modify a private IP address. For more information about internal network communication, see Internal network.

Public IP addresses

ECS instances within VPCs support the following types of public IP addresses:
  • PublicIP addresses: the public IP addresses assigned by ECS.
  • Elastic IP addresses (EIPs). For more information, see What is Elastic IP Address?

The following table describes the major differences between the two types of public IP addresses.

Item PublicIP address EIP
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.
Method to obtain an address 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 a cloud resource.
Maximum number of addresses that can be assigned to or associated with a single ECS instance Each ECS instance can be assigned a single PublicIP address. 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 address After a PublicIP address is assigned to an ECS instance, the address can only be released and cannot be disassociated from the instance. See Disassociate an EIP from a cloud resource.
Method to release an address See Release a pay-as-you-go EIP.
Method to view a MAC address ECS instances within 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 within VPCs cannot be discovered regardless of whether the instances are assigned PublicIP addresses or associated with EIPs.

Billing

You are billed only for outbound traffic to the Internet. For more information, see Public bandwidth.