Identify instance creation failure events and improve your ECS instance creation success rate.
What is a creation failure?
When you call the RunInstances to create instances, ECS instance resource inventory and assignable private IP addresses of vSwitches change dynamically. If insufficient resources are available, the system retries. In extreme cases, an instance cannot be created and the system automatically recycles or releases its resources. Alibaba Cloud then sends a SystemFailure.Delete event, and the system releases the involved instance resources. If you already paid for the instance, you receive a refund after the resources are released. Pay-as-you-go instances incur no charges during creation.
When you receive the SystemFailure.Delete event during instance creation, handle it in one of the following ways:
-
Wait for the system to automatically release the failed instance resources. In most cases, resources are released within 5 minutes.
-
Manually release the failed instance.
View an instance creation failure event
Call the DescribeInstanceHistoryEvents operation by using Alibaba Cloud CLI to check whether an instance creation failure event occurred.
The following example queries all historical instance creation failure events in the Executing or Executed state. Set EventPublishTime.Start and EventPublishTime.End to query events within a specific time range.
aliyun ecs DescribeInstanceHistoryEvents --InstanceEventCycleStatus.1 Executing --InstanceEventCycleStatus.2 Executed --EventType SystemFailure.Delete
The following table maps the instance status in DescribeInstances to the event status in DescribeInstanceHistoryEvents.
|
Status |
DescribeInstances status |
DescribeInstanceHistoryEvents status |
|
Instance is being created. |
Creating or Starting |
None |
|
Creation fails; instance pending recycling. |
Stopped |
SystemFailure.Delete: Executing |
|
Pending instance is manually released. |
Instance not found. |
SystemFailure.Delete: Avoided |
|
Failed instance is recycled. |
Instance not found. |
SystemFailure.Delete: Executed |
Improve the success rate of instance creation
After you call the RunInstances to create instances, monitor the creation progress.
-
If all instances are in the Running state, batch creation succeeded.
-
If some instances are in the Stopped or Creating state, call DescribeInstanceHistoryEvents to confirm whether creation failed. Resources of failed instances are released within 5 minutes.
-
If an instance fails to be created, call DescribeAvailableResource to check whether the system has insufficient resources or the vSwitch has insufficient private IP addresses.
To improve creation success:
-
Before creating instances, query ECS resource availability and idle private IP addresses in the target vSwitch's CIDR block. For example, call DescribeAvailableResource to query resources in a zone.
-
Use auto provisioning to create instances from larger resource pools. See Overview.
-
Use elasticity assurance to reserve resources with specific attributes in a private pool. See Overview of Elasticity Assurance.