This topic describes how to improve the success rate and O&M efficiency of ECS instances when an instance fails to be created.

Background

After you create instances in the ECS console or call RunInstances, and all the ECS instances are in the running(Running) state, it indicates that the ECS instances are created. However, ECS instances may fail to be created because of insufficient inventory in some cases. The number of ECS instances available in the current region and the number of private IP addresses in the VSwitch change dynamically. Then ECS triggers a system event with the SystemFailure.Deleteevent code.

When an instance fails to be created, you cannot view the new instance on the Instances & Images > Instances page in the ECS console or by calling DescribeInstances. You need to query the instance on the Events page. If you have made a payment, your payment will be refunded. On the Events page, perform the following operations on the ECS instance that fails to be created:
  • Wait for the system to release the ECS instance. An ECS instance is released within five minutes if it fails to be created.
  • Release the instance.

View instance fails to be created events

You can use Alibaba Cloud CLI to call DescribeInstanceHistoryEvents to view instance fails to be created events. For more information about how to use other developer tools to call APIs, see Quick start for ECS APIs.

aliyun ecs DescribeInstanceHistoryEvents --RegionId TheRegionId --InstanceEventCycleStatus.
Note In the example, you can specify the EventPublishTime.Start and EventPublishTime.End parameters to view information about events during the specified time period.

For more information about how to use the ECS console to view instance fails to be created events, see System events.

Different states

The following table describes different states that are returned when you query on the Instances page in the ECS console or by calling DescribeInstances and system events with the even code of SystemFailure.Delete.

Item Instance state Event state
The instance is being created Pending N/A
An instance fails to be created event occurs Stopped Executing
The instance is manually released N/A Avoided
The instance is released by the system N/A Executed

Improve the success rate

We recommend that you perform the following steps to create an ECS instance to improve the success rate:

  1. Call DescribeAvailableResource to confirm that sufficient ECS instances are available in the specified region and zone, and that the remaining private IP addresses are sufficient in the VSwitch.
  2. Create an instance in the ECS console or call RunInstances.
  3. Call DescribeInstanceStatus or DescribeInstances to confirm that the new instance is in in the running (Running) state.
  4. If the instance is in the pending state for a long time, call DescribeInstanceHistoryEvents to check whether the instance fails to be created.