Stop an instance when you don’t need it running. A stopped instance accrues no compute usage, and it keeps its volumes, network interface and addresses. Start it again when you need it, the same instance, possibly on a different machine.
Before you begin
- To stop: an instance in
RUNNING. - To start: an instance in
STOPPEDorFAILED. - The
originCLI, signed in. See CLI access.
Note: A stopped instance’s volumes are still billed. To stop paying for them, terminate the instance. See Terminate an instance.
Stop the instance
-
Request the stop:
Terminal window origin compute stop-instance --instance-urn <instance-urn>The platform asks the guest operating system to shut down cleanly. A guest that hasn’t shut down after 5 minutes is powered off.
-
Run
get-instanceuntilstatusreadsSTOPPED:Terminal window origin compute get-instance --instance-urn <instance-urn>The instance passes through
STOPPINGfirst.
You can also shut the guest down from inside, with sudo poweroff. The instance then goes from RUNNING straight to STOPPED.
Start the instance
-
Request the start:
Terminal window origin compute start-instance --instance-urn <instance-urn> -
Run
get-instanceuntilstatusreadsRUNNING. The instance passes throughPENDINGfirst. -
Verify that the guest is up. Its
healthChecks.availabilityreadsAVAILABLEonce the platform has seen its network stack answer. See Instance health checks.
Starting an instance that is already RUNNING reports success and changes nothing. Starting one that is still PENDING re-sends the start it is waiting for, without disturbing a guest that is coming up. A start is refused while the instance is INITIALIZING, because it starts on its own once its resources are ready, and while it is STOPPING or SHUTTING_DOWN.
Using the API
The startInstance and stopInstance mutations take the instance URN:
mutation { compute { stopInstance(input: { instanceUrn: "<instance-urn>" }) { accepted message } }}If this fails
- The start is refused with
PRODUCT_UNAVAILABLE. The instance’s type is no longer offered. Change it to an available type, then start it. See Change an instance’s type. - The start is refused with
INSUFFICIENT_CAPACITY. A stopped instance is placed afresh when it starts, and no machine has room for its type right now. Retry later, or change it to a smaller type. - The instance ends up
FAILED. Read itsstatusReason. See When a lifecycle operation fails.