Amazon Elastic Compute Cloud
User Guide (API Version 2011-12-15)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Stopping and Starting Instances

This section describes how to stop and start instances that use Amazon EBS volumes as their root devices.

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.

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

  • When you start a stopped instance, the IP address is likely to change. By default, the Ec2ConfigService service (Windows) changes the instance hostname to match the new IP and initiates a reboot.

  • By default, Windows instance assigns drive letters to all the attached EBS volumes. When the Windows instance is stopped and started again, the drive letter mapping is likely to change. For information on changing this default behavior, go to Using Ec2Config Service in the Microsoft Windows Guide.

  • If you've registered the instance with a load balancer, it is likely the load balancer will not be able to route traffic to your instance after you've stopped and started the instance. You must de-register the instance from the load balancer after stopping, and then register after starting the instance. For more information on de-registering and registering your instances with a load balancer, go to De-Registering and Registering Amazon EC2 Instances section in the Elastic Load Balancer Developer Guide.

[Important]Important

If an instance reboots (intentionally or unintentionally), the data on the instance store will survive.

However, under the following circumstances the data in the instance store will be lost:

  • Failure of an underlying drive.

  • Running an instance on degraded hardware.

  • Stopping an Amazon EBS-backed instance.

  • Terminating an instance.

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.

    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.

    PROMPT>  ec2-start-instances i-10a64379

    Amazon EC2 returns output similar to the following example.

    IMAGE i-10a64379 stopped pending 

API

To stop an instance

  • Construct the following Query request.

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

    Following is an example response.

    <StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
      <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>

To start an instance

  • Construct the following Query request.

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

    Following is an example response.

    <StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
       <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>   
       <instancesSet>
          <item>
             <instanceId>exampleinstanceid</instanceId>
             <currentState>
                <code>0</code>
                <name>pending</name>
             </currentState>
             <previousState>
                <code>80</code>
                <name>stopped</name>
             </previousState>
          </item>
       </instancesSet>
    </StartInstancesResponse>