This topic describes instance creation failure events and how to improve the success rate of your Elastic Compute Service (ECS) instance creation.
What is a creation failure?
When you call the RunInstances operation to create instances, the inventory of ECS instance resources and the number of assignable private IP addresses of vSwitches dynamically change. If the system does not have sufficient resources to create instances, the system retries to create the instances. In extreme cases, an instance cannot be created and the system automatically recycles or releases the instance resources. When Alibaba Cloud detects that an ECS instance fails to be created, Alibaba Cloud immediately sends an instance creation failure event named SystemFailure.Delete to the system. The system handles the event and releases the instance resources involved. If you already paid for the instance, you are refunded after the instance resources are released. For pay-as-you-go instances, no payments are required during instance creation.
When you receive the SystemFailure.Delete event during instance creation, you can use one of the following methods to handle the event:
-
Wait until the system automatically releases the resources of the instance that fails to be created. In most cases, instance resources are automatically released within 5 minutes of an instance creation failure.
-
An instance that you manually release will fail to create and will be released.
View an instance creation failure event
Use Alibaba Cloud CLI to call the DescribeInstanceHistoryEvents operation to check whether an instance creation failure event occurs.
The following example shows how to query all historical instance creation failure events that are in the Executing or Executed state. You can set the EventPublishTime.Start and EventPublishTime.End parameters to query events within a specific time range.
aliyun ecs DescribeInstanceHistoryEvents --InstanceEventCycleStatus.1 Executing --InstanceEventCycleStatus.2 Executed --EventType SystemFailure.Delete
The following table describes the relationships between the status in the DescribeInstances operation and the status in the DescribeInstanceHistoryEvents operation.
|
Status |
Instance status in the DescribeInstances operation |
Event Interface: Instance Status |
|
The instance is being created. |
Creating or Starting |
None |
|
The instance fails to be created and is to be recycled. |
Stopped |
Executing state of the SystemFailure.Delete event |
|
The instance to be recycled is manually released. |
The instance cannot be found. |
Avoided state of the SystemFailure.Delete event |
|
The instance that fails to be created is recycled. |
The instance cannot be found. |
Executed state of the SystemFailure.Delete event |
Improve the success rate of instance creation
After you create instances by calling the RunInstances operation, you can monitor the instance creation progress.
-
If all instances are in the Running state, the instances are batch created.
-
If some instances are in the Stopped or Creating state, you can call the DescribeInstanceHistoryEvents operation to confirm whether the instance creation failed. Resources for failed instances are released within 5 minutes.
-
If an instance fails to be created, you can call the DescribeAvailableResource operation to check whether the system has insufficient resources or the vSwitch has insufficient private IP addresses.
To ensure that instances can be created, we recommend that you perform the following operations:
-
Before you create ECS instances in a region and zone, query ECS resource availability and the number of idle private IP addresses in the CIDR block associated with the specified vSwitch in the region and zone. For example, you can call the DescribeAvailableResource operation to query resources in a zone.
-
Use Auto Provisioning to flexibly create instances from larger resource pools. For more information, see Overview.
-
You can use an elasticity assurance to reserve resources that match specific attributes in a private pool in advance. For more information, see Overview of Elasticity Assurance.