This topic describes how to improve the success rate and O&M efficiency of ECS instances when an instance fails to be created.
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.
- 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.
For more information about how to use the ECS console to view instance fails to be created events, see System events.
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:
- 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.
- Create an instance in the ECS console or call RunInstances.
- Call DescribeInstanceStatus or DescribeInstances to confirm that the new instance is in in the running (Running) state.
- If the instance is in the pending state for a long time, call DescribeInstanceHistoryEvents to check whether the instance fails to be created.