This topic describes how to create an Elastic IP Address (EIP) and associate the EIP with an ECS instance. This enables the ECS instance to connect to the Internet.
Prerequisites
An ECS instance is created. For more information, see Create an instance.
You cannot associate an EIP with an ECS instance that is already assigned a public IP address. You can convert the public IP address to a more flexible EIP. For more information, see Convert the static public IP address of a VPC-type ECS instance to an EIP.
Configuration flow
Step 1: Request an EIP
An EIP is a standalone public IP address that you can purchase. Before you can use an EIP, you must request an EIP.
- Log on to the Elastic IP Address console .
On the Elastic IP Addresses page, click Create EIP.
On the purchase page, configure the EIP, and then click Buy Now and complete the payment.
Configuration
Description
Billing Method
Select a billing method for the EIP. In this topic, Pay-As-You-Go is selected.
Region
Select the region for the EIP.
Make sure that the EIP is in the same region as the ECS instance that you want to associate it with.
Line Type
Select a line type for the EIP. In this topic, BGP (Multi-ISP) is selected.
Network Type
Select a network type for the EIP.
Currently, only the Internet network type is supported.
Security Protection
Select a security protection level. In this topic, Default is selected.
Address Pool
Select an IP address pool. If you do not select a specific address pool, an EIP is allocated to you from the public IP address pool of Alibaba Cloud by default.
Traffic
Select a metering method for the EIP traffic. In this topic, Pay-by-bandwidth is selected.
Peak Bandwidth
Select a peak bandwidth for the EIP. In this topic, this parameter is set to 1 Mbps.
Name
Enter a name for the EIP.
Resource Group
Select the resource group to which the EIP belongs.
Billing Cycle
Select a billing cycle for the EIP.
Currently, EIP that use the pay-by-bandwidth billing method support only the Daily billing cycle.
Quantity
Select the number of EIP to purchase.
Step 2: Associate the EIP with an ECS instance
Associate the EIP with an ECS instance in a virtual private cloud (VPC). After the ECS instance is associated with the EIP, the ECS instance can communicate with the Internet.
- Log on to the Elastic IP Address console .
In the top navigation bar, select the region where the EIP is located.
On the Elastic IP Addresses page, find the target EIP and click Associate with Resource in the Actions column.
In the Associate EIP with Resource dialog box, set the following parameters and click OK.
Configuration
Description
Instance Type
Select ECS Instance.
Select an instance to associate
Select the ECS instance that you want to associate.
The ECS instance to be associated must meet the following conditions:
The ECS instance is deployed in a VPC.
The ECS instance is in the Running or Stopped state.
The ECS instance is in the same region as the EIP to be associated.
The ECS instance is not assigned a static public IP address and is not associated with an EIP.
NoteEach ECS instance can be associated with only one EIP.
To associate multiple EIPs with an ECS instance, associate a secondary elastic network interface (ENI) with the ECS instance and associate EIPs with the secondary ENI. For more information, see Associate an EIP with an ECS instance.
Step 3: Test the connection
After you associate the EIP with the ECS instance, verify that the ECS instance can connect to the Internet.
Log on to the ECS instance that is associated with the EIP.
For more information about how to log on to an ECS instance, see Overview of connection methods.
Run the following command to verify the Internet connection.
ping <public domain name>
The test result shows that the ECS instance can communicate with the Internet.
References
AllocateEipAddress: Requests an EIP instance.
AssociateEipAddress: Associates an EIP instance with a cloud resource in the same region.
ReleaseEipAddress: Releases a specified EIP instance.