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 through 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 is in the Running state, it is functioning properly. You can run services on it. 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 through 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 has been stopped or after it has been created but not started, it is in the Stopped state. Instances in the Stopped state cannot provide external services. Yes
Expired Stopped Stable After subscription instances expire or pay-as-you-go instances are stopped due to overdue payments, the instances enter the Expired state. Instances in the Expired state cannot provide external services. For more information about resource state changes, see Subscription and Pay-As-You-Go. 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 to query the states of instances. The following figure shows transitions between the states in API responses.