An Elastic Compute Service (ECS) instance transitions through different states from the moment it is created to the moment it is released.
Instance states are classified into console-based states and API-based states based on where the states can be queried. Console-based states are the instance states that can be queried in the ECS console. API-based states are the instance states that can be queried in ECS API by calling the DescribeInstanceStatus or DescribeInstances operation. An API-based state may correspond to multiple console-based states based on whether a subscription instance has expired or whether a payment is overdue for an instance within your account.
Instance states are classified into stable and transitory states based on their attributes. Transitory states are the states that an instance temporarily enters before it enters a stable state. If an instance remains in a transitory state for an extended period of time, an exception occurs.
|Console-based state||API-based state||State attribute||Description|
|Pending||Pending||Transitory||After an instance is created, it is in this state before it enters the Starting (Starting) state.|
|Starting||Starting||Transitory||After an instance is created, started, or restarted, it is in this state before it enters the Running (Running) state.|
|Running||Running||Stable||When an instance is running normally, it is in this state.
Note An instance can be externally accessed only when it is in the API-based Running state. Instances in the API-based Running state may be in the console-based Running or Expiring state.
|Expiring||Running||Stable||When a subscription instance is about to expire, it enters this state but continues to run normally. We recommend that you renew the instance at your earliest convenience. For more information, see Renewal overview.|
|Stopping||Stopping||Transitory||After you stop or hibernate an instance, it enters this state before it enters the Stopped (Stopped) state.|
|Stopped||Stopped||Stable||When an instance is created but not started or after an instance is stopped or hibernated,
it remains in this state.
Note After you create an instance by using the ECS console or by calling the RunsInstances operation, the instance is automatically started.
|Expired||Stopped||Stable||When a subscription instance expires or when a pay-as-you-go instance is stopped due to an overdue payment, the instance enters this state and is pending release. For information about whether instance resources are retained, see Changes in resource status after an instance expires and Resource status when an instance is stopped due to an overdue payment.|
|Locked||Stopped||Stable||Your instance may enter this state for specific reasons. For example, your instance may enter the Locked state because you have an overdue payment within your account or because security risks are detected within your account. To unlock the instance, you can submit a ticket.|
|To Be Released||Stopped||Stable||
When you apply for a refund for an unexpired subscription instance, the instance enters this state.
Manage the status of instances
To manage the status of instances, we recommend that you use the management tools provided by Alibaba Cloud, such as the ECS console and ECS API. For example, to enable the economical mode when you are stopping a pay-as-you-go instance or to restart an instance for a new hostname to take effect, you must use the ECS console or call an API operation instead of performing operations within the instance operating system.
- Create an instance
The created instance enters the Pending (Pending) state, the Starting (Starting) state, and then the Running (Running) state. You can access the instance when it is in the Running (Running) state. For example, you can connect to the instance to manage its operating system configurations or build websites and use a browser to access the websites.
- Stop an instance
The instance enters the Stopping (Stopping) state and then the Stopped (Stopped) state. You must stop an instance before you can perform specific operations on the instance, such as replacing the operating system, changing the private IP address, and changing the instance type if the instance is a pay-as-you-go one.
If you enable the economical mode when you stop a pay-as-you-go instance, the computing resources (vCPUs and memory) and public IP address of the instance are released, and you are no longer charged for them. Other resources of the instance including the disks and the associated elastic IP address (EIP) are retained, and you continue to be charged for them.
- Start an instance
The instance enters the Starting (Starting) state and then the Running (Running) state.
- Hibernate an instance
The instance enters the Stopping (Stopping) state and then the Stopped (Stopped) state. When you hibernate an instance, the operating system of the instance saves data stored in memory to the system disk. This data includes running applications and their current states. When you wake the instance, the operating system reads the memory data saved to the system disk. Meanwhile, the operating system resumes the previously running applications and restores them to the states they were in when the instance was hibernated.
When you hibernate a pay-as-you-go instance for which the No Fees for Hibernated Instances mode is enabled, the computing resources (vCPUs and memory) and public IP address of the instance are released, and you are no longer charged for them. Other resources of the instance including the disks and the associated EIP are retained, and you continue to be charged for them.
- Reboot the instance
The instance enters the Stopping (Stopping) state, the Starting (Starting) state, and then the Running (Running) state. After you perform specific instance operations such as changing the instance type, you must restart the instance for the operations to take effect.
When an instance is restarted, it may be moved to a new host. If you want your instances to remain on the same host, you can purchase a dedicated host and then associate instances with it.
- Release an instance
Only instances in the API-based Stopped state can be released. Instances in the API-based Stopped state may be in the console-based Stopped or Expired state. Unexpired subscription instances cannot be released. If you want to release an unexpired subscription instance, you can apply for a refund or change the instance into a pay-as-you-go instance.
When an instance is released, its ID, public IP address, system disk, and data disks for which Release with Instance is enabled are also released and cannot be recovered. If the instance is associated with an EIP, the EIP is automatically disassociated from the instance and retained. The data disks for which Release with Instance is not enabled are automatically detached from the instance and retained. Proceed with caution when you release instances. To prevent accidental release of instances, we recommend that you enable release protection for the instances.