Amazon Elastic Compute Cloud
User Guide (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Stopping and Starting Instances

You can stop and restart Amazon EC2 instances that use Amazon EBS volumes as their root devices.

Note

If you try to stop an instance that uses an instance store as its root device, you receive an error.

When an instance is stopped, it is shut down, and any data stored in RAM is not preserved. You're not billed for hourly usage or data transfer, but you're billed for any Amazon EBS volume storage. You can start the instance at any time with a start request. Each time you transition an instance from stopped to started, we charge a full instance hour, even if transitions happen multiple times within a single hour.

For information about the differences between stopping an instance and terminating an instance, see Stopping Instances.

AWS Management Console

To stop and start an instance

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Click Instances in the Navigation pane.

    The console displays a list of running instances.

  3. Select an instance, select Instance Actions, and click Stop Instance.

    A confirmation dialog box appears.

  4. Click the Yes, Stop Instance.

    The instance is stopped and saved as a snapshot.

  5. To restart the stopped instance, select Stopped Instances from the Viewing list box.

    The newly stopped instance appears in the list.

  6. Select the instance, select Instance Actions, and click Start Instance.

    The instance begins restarting.

Command Line Tools

To stop and start an instance

  1. Use the ec2-stop-instances command to stop an instance.

    PROMPT>  ec2-stop-instances i-10a64379

    Amazon EC2 returns output similar to the following example.

    IMAGE i-10a64379 running stopping 
  2. Use the ec2-start-instances command to restart the instance.

    PROMPT>  ec2-start-instances i-10a64379

    Amazon EC2 returns output similar to the following example.

    IMAGE i-10a64379 stopped pending 

API

To stop and start an instance

  1. Construct the following Query request to stop an instance.

    https://ec2.amazonaws.com/
    ?Action=StopInstances
    &InstanceId.1=i-10a64379
    &AUTHPARAMS

    The following is an example response.

    <StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
      <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
      <instancesSet>
         <item>
            <instanceId>exampleinstanceid</instanceId>
            <currentState>
               <code>64</code>
               <name>stopping</name>
            </currentState>
            <previousState>
               <code>16</code>
               <name>running</name>
            </previousState>
      </instancesSet>
    </StopInstancesResponse>
  2. Construct the following Query request to restart the instance.

    https://ec2.amazonaws.com/
    ?Action=StartInstances
    &InstanceId.1=i-10a64379
    &AUTHPARAMS

    The following is an example response.

    <StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
       <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>   
       <instancesSet>
          <item>
             <instanceId>i-10a64379</instanceId>
             <currentState>
                <code>0</code>
                <name>pending</name>
             </currentState>
             <previousState>
                <code>80</code>
                <name>stopped</name>
             </previousState>
          </item>
       </instancesSet>
    </StartInstancesResponse>