All Products
Search
Document Center

Elastic Compute Service:Instance lifecycle

Last Updated:May 15, 2023

An Elastic Compute Service (ECS) instance transitions through different states from the moment it is created to the moment it is released.

Instance states

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 by calling the DescribeInstanceStatus or DescribeInstances operation in the ECS API. An API-based state may correspond to multiple console-based states based on scenarios, such as whether a subscription instance has expired or whether a payment is overdue for an instance in 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.

The following table describes the different states that an instance may go through during its lifecycle.

Console-based state

API-based state

State attribute

Status 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, it is in this state.

Important

The Running state of an instance indicates only that the instance is running, but it does not necessarily mean that the operating system of the instance is running. You can check the health status of the instance to determine whether the operating system of the instance is running. Network services work as expected and you can connect to the instance by using different methods, such as over SSH or Remote Desktop Protocol (RDP), only when the operating system of the instance is running. For more information, see View the health status of an instance.

Expiring

Running

Stable

When a subscription instance is about to expire, it enters this state but continues to run as expected. 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 RunInstances 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 the "Changes in resource states after a subscription instance expires" section of Subscription and Pay-as-you-go.

Locked

Stopped

Stable

An instance enters this state when it is locked for security reasons. You can go to the Penalties List page in the Security Control console to apply to unlock the instance.

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

The following figure shows the transitions between API-based instance states.

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 stop 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.

To manage the status of instances, you can perform the following operations:

  • 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, when an instance is in the Running (Running) state, you can connect to the instance to manage its operating system configurations, 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 instance.

    If a pay-as-you-go instance is stopped in economical mode, the computing resources (vCPUs and memory) and public IP address of the instance are released, and you are no longer charged for these resources. Other resources of the instance, including the disks and the associated elastic IP addresses (EIPs), 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 these applications to the states they were in when the instance was hibernated.

    If a pay-as-you-go instance is hibernated in the No Fees for Hibernated Instances mode, the computing resources (vCPUs and memory) and public IP address of the instance are released, and you are no longer charged for these resources. Other resources of the instance, including the disks and the associated EIPs, are retained and you continue to be charged for them.

  • Restart an 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 the instance with the dedicated host.

  • 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, 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 has been 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 instances.