All Products
Search
Document Center

:The ECS instance created when you use the CreateInstance API does not have a public IP address

Last Updated:Apr 28, 2022

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.

  1. You can call CreateSecurityGroup to create a security group.
  2. You can call this operation to CreateInstance create an ECS instance.
  3. Call the AllocatePublicIpAddress to assign a public IP address.
  4. You can call CreateDisk to add a data disk.
    Note: This step is optional.
  5. Call the RebootInstance operation to reboot the ECS instance.
  6. After a successful restart, confirm that the public IP address can be PING.

Applicable scope

  • Elastic Compute Service (ECS)