Stopping and Starting VMs

You can stop a running virtual machine (VM) at any time, and then start it again. Stopping a VM enables you, for example, to service the VM or to treat its root volume.

Stopping and Starting VMs Using Cockpit v2

Stopping a VM

  1. Click inside the VMs dashboard to make checkboxes appear.

  2. Check the box of the running VM you want to stop.

    Multiselection is available.

    The VM is selected and an action menu appears.

  3. Click IconStop Stop.
    The STOP VMs confirmation dialog box appears.

  4. Click Submit.
    The state of the selected VM changes to IconPending stopping, and then to IconStopped stopped once the operation is completed.

    If the VM does not stop, you can force it to stop. Beware that forcing a VM to stop may damage your VM system and lose data. Therefore, it is recommended to avoid using force stop. For more information about it and why the VM does not stop properly, see About VM Lifecycle > Force Stop.

    To force a VM to stop, click IconForceStop Force Stop.

Starting a VM

  1. Click inside the VMs dashboard to make checkboxes appear.

  2. Check the box of the stopped VM you want to start.

    Multiselection is available.

    The VM is selected and an action menu appears.

  3. Click IconStart Start.
    The state of the selected VM changes to IconPending pending, and then to IconRunning running once the operation is completed.

Stopping and Starting VMs Using OSC CLI

Stopping VMs

The StopVms command stops one or more running virtual machines (VMs).
You can stop only VMs that are valid and that belong to you. Data stored in the VM RAM is lost.

Request sample
$ osc-cli api StopVms --profile "default" \
    --VmIds '["i-12345678"]'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • ForceStop: (optional) Forces the VM to stop.

  • VmIds: One or more IDs of VMs.

The StopVms command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • Vms: Information about one or more stopped VMs.

    • CurrentState: The current state of the VM (InService | OutOfService | Unknown).

    • PreviousState: The previous state of the VM (InService | OutOfService | Unknown).

    • VmId: The ID of the VM.

Result sample
{
  "Vms": [
    {
      "VmId": "i-12345678",
      "PreviousState": "running",
      "CurrentState": "stopping"
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Starting VMs

The StartVms command start one or more virtual machines (VMs).
You can start only VMs that are valid and that belong to you.

Request sample
$ osc-cli api StartVms --profile "default" \
    --VmIds '["i-12345678"]'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • VmIds: One or more IDs of VMs.

The StartVms command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • Vms: Information about one or more started VMs.

    • CurrentState: The current state of the VM (InService | OutOfService | Unknown).

    • PreviousState: The previous state of the VM (InService | OutOfService | Unknown).

    • VmId: The ID of the VM.

Result sample
{
  "Vms": [
    {
      "VmId": "i-12345678",
      "PreviousState": "stopped",
      "CurrentState": "pending"
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Stopping and Starting Instances Using AWS CLI

Stopping Instances

To stop one or more instances, use the stop-instances command following this syntax:

Request sample
$ aws ec2 stop-instances \
    --profile YOUR_PROFILE \
    --instance-ids i-12345678 \
    --force \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • instance-ids: One or more instance IDs.

  • (optional) force: If set to true, forces the instance to stop without properly exiting running applications.

    Beware that forcing an instance to stop may damage your instance system and data. Therefore, it is recommended to avoid using force stop. For more information about it and why the instance does not stop properly, see About VM Lifecycle > Force Stop.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The stop-instances command returns the following elements:

  • StoppingInstances: Information about one or more stopping instances. This element contains the following information for each instance:

    • InstanceId: The ID of the instance.

    • CurrentState: The current state of the instance, with the code and the name of the state.

    • PreviousState: The state of the instance before the action, with the code and the name of the state.

Result sample
{
    "StoppingInstances": [
        {
            "InstanceId": "i-12345678",
            "CurrentState": {
                "Code": 64,
                "Name": "stopping"
            },
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}

The state of the specified instances changes to stopping, and then to stopped once the operation is completed.

Starting Instances

To start one or more instances, use the start-instances command following this syntax:

Request sample
$ aws ec2 start-instances \
    --profile YOUR_PROFILE \
    --instance-ids i-12345678 \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • instance-ids: One or more instance IDs.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The start-instances command returns the following elements:

  • StartingInstances: Information about one or more starting instances. This element contains the following information for each instance:

    • InstanceId: The ID of the instance.

    • CurrentState: The current state of the instance, with the code and the name of the state.

    • PreviousState: The state of the instance before the action, with the code and the name of the state.

Result sample
{
    "StartingInstances": [
        {
            "InstanceId": "i-12345678",
            "CurrentState": {
                "Code": 0,
                "Name": "pending"
            },
            "PreviousState": {
                "Code": 80,
                "Name": "stopped"
            }
        }
    ]
}

The state of the specified instances changes to pending, and then to running once the operation is completed.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.