All Products
Search
Document Center

Elastic Compute Service:Instance lifecycle

Last Updated:Feb 08, 2024

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 how the states can be queried. Console-based states are instance states that can be queried in the ECS console, and API-based states are 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 specific scenarios, such as whether a subscription instance is expired or whether a payment is overdue for an instance in your Alibaba Cloud account.

Instance states are classified into stable and transitory states based on attributes. Transitory states are the states that an instance temporarily enters before the instance 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 lifecycle states of an instance.

Console-based state

API-based state

State attribute

State description

Pending

Pending

Transitory

After an instance is created, the instance is in this state before it enters the Starting (Starting) state.

Starting

Starting

Transitory

After an instance is created, started, or restarted, the instance is in this state before it enters the Running (Running) state.

Running

Running

Stable

An instance is in this state when it is running.

Important

The Running state indicates that an instance is running but does not always 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. If the operating system of the instance is running, network services work as expected and you can connect to the instance by using various methods, such as SSH or Remote Desktop Protocol (RDP). For more information, see View the health status of an instance.

Expiring

Running

Stable

When a subscription instance is about to expire, the instance enters this state but continues to run as expected. We recommend that you renew the instance at the earliest opportunity. For more information, see Renewal overview.

Stopping

Stopping

Transitory

After you stop or hibernate an instance, the instance 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, the instance remains in this state.

Note

After you create an instance in 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 Impacts of resource expiration and Pay-as-you-go.

Locked

Stopped

Stable

An instance enters this state when the instance is locked for security reasons. You can go to the Penalties List page in the Security Control console to request 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.

image

To manage the status of instances, we recommend that you use the management tools of 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 to allow a new hostname to take effect, 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 the instance 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 the corresponding 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. If the instance is a pay-as-you-go instance, you must stop the instance to perform specific operations on the instance, such as replacing the operating system, changing the private IP address, and changing the instance type.

    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. 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 are still charged for these resources.

  • 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 the data that is stored in memory, including running applications and their current states, to the system disk. When you resume the instance, the operating system reads the saved data from the system disk. The operating system resumes the previously running applications and restores the applications to the states they were in when the instance was hibernated.

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

  • 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 to allow the operations to take effect.

    When an instance is restarted, the instance may be moved to a new host. If you want your instance to remain on the same host, you can purchase a dedicated host and associate the instance with the 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 state 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 billing method to pay-as-you-go.

    When an instance for which Release with Instance is enabled is released, the ID, public IP address, system disk, and data disks of the instance 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 of an instance for which Release with Instance is disabled 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.