The lifecycle of an ECS instance begins when the instance is created and ends when the instance is released. This topic describes the states that an ECS instance may go through during its lifecycle.

Instance states

The following table describes the states that an ECS instances may go through during its lifecycle.

State State in an API response State attribute Description Visible in the ECS console
Preparing Pending Intermediate After an instance is created, it is in this state before it enters the Running state. If the instance remains in this state for an extended period of time, an exception occurs. No
Starting Starting Intermediate After you start or restart an instance by using the ECS console or by calling an API operation, the instance enters this state before it enters the Running state. If the instance remains in this state for an extended period of time, an exception occurs. Yes
Running Running Stable If an instance runs properly, it is in this state.
Note An ECS instance can be accessed externally only when it is in the Running state.
Yes
Expiring Running Stable A subscription instance remains in the Expiring state for 15 days before it expires. We recommend that you renew your instances in the Expiring state in a timely manner. For more information, see Renewal overview. Yes
Stopping Stopping Intermediate After you stop an instance by using the ECS console or by calling an API operation, the instance enters this state before it enters the Stopped state. If the instance remains in this state for an extended period of time, an exception occurs. Yes
Stopped Stopped Stable After an instance is stopped or after it is created but has not started, it is in the Stopped state.
Note An ECS instance can be accessed externally only when it is in the Running state.
Yes
Expired Stopped Stable After a subscription instance expires or a pay-as-you-go instance is stopped due to overdue payments, the instance enters the Expired state. For more information about resource status changes, see Subscription and Pay-as-you-go.
Note An ECS instance can be accessed externally only when it is in the Running state.
Yes
Locked Stopped Stable If your account has an overdue payment or your account is insecure, your instance enters the Locked state. You can submit a ticket to unlock the instance. Yes
To Be Released Stopped Stable

If you apply for a refund for a subscription instance before the instance expires, the instance enters the To Be Released state.

Yes

States in API responses

You can call the DescribeInstanceStatus or DescribeInstances operation to query the statuses of instances. The following figure shows transitions between the states in API responses.