Issue
When you use the CreateInstance API to create an ECS instance, it is found that the ECS instance does not have the configuration of a public IP address.
Cause
By default, no public IP address is assigned to an ECS instance created by using the CreateInstance API. You need to use the AllocatePublicIpAddress API to assign a public IP address to the ECS instance. In addition, you can also use the AssociateEipAddress API to assign Elastic IP Address to the ECS instance.
Solution
Take note of the following items:
- Before you perform high-risk operations such as modifying the specifications or data of an Alibaba Cloud instance, we recommend that you check the disaster recovery and fault tolerance capabilities of the instance to ensure data security.
- Before you modify the specifications or data of an Alibaba Cloud instance, such as an Elastic Compute Service (ECS) instance or an ApsaraDB RDS instance, we recommend that you create snapshots or enable backups for the instance. For example, you can enable log backups for an ApsaraDB RDS instance.
- If you have granted specific users the permissions on sensitive information, such as usernames and passwords, or submitted sensitive information in the Alibaba Cloud Management Console, we recommend that you modify the sensitive information at the earliest opportunity.
Typically, the order in which ECS instances with public IP addresses are created through APIs is as follows.
- You can call CreateSecurityGroup to create a security group.
- You can call this operation to CreateInstance create an ECS instance.
- Call the AllocatePublicIpAddress to assign a public IP address.
- You can call CreateDisk to add a data disk.
Note: This step is optional.
- Call the RebootInstance operation to reboot the ECS instance.
- After a successful restart, confirm that the public IP address can be PING.
Applicable scope
- Elastic Compute Service (ECS)