Amazon Elastic Compute Cloud
User Guide (API Version 2012-04-01)
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...

Modifying Attributes of a Stopped Instance

Instances have a set of attributes, and you can modify some of the attributes only when the instance is stopped. Following are those attributes:

  • Kernel

  • RAM disk

  • Instance type

  • User data

If you try to modify one of these attributes while the instance is running, Amazon EC2 returns the IncorrectInstanceState error.

For a list of all the available instance attributes you can change (not just those that require the instance to be stopped), go to ec2-modify-instance-attribute in the Amazon Elastic Compute Cloud Command Line Reference.

[Note]Note

Although you can use the AWS Management Console to stop and start instances, and to change the instance type or user data, you can't use it to modify the kernel or RAM disk instance attributes. That functionality is available only through the command line tools or API.

For information about kernels and RAM disks, see Kernels and RAM Disk FAQ.

AWS Management Console

To change the instance type for a stopped instance

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

  2. In the Navigation pane, click Instances.

  3. In the My Instances pane, right-click a stopped instance, and then click Change Instance Type.

  4. In the Change Instance Type dialog box, in the Instance Type drop-down list, select the type of instance you want, and then click Yes, Change.

To change the user data for a stopped instance

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

  2. In the Navigation pane, click Instances.

  3. In the My Instances pane, right-click a stopped instance, and then click View/Change User Data.

  4. In the View/Change User Data dialog box, update the user data, and then click Yes, Change.

Command Line Tools

You can modify only a single attribute with each command.

To change an attribute of a stopped instance

  1. Choose one of the following commands to get the current value of the attribute of interest.

    PROMPT>  ec2-describe-instance-attribute instance_id --kernel
    PROMPT>  ec2-describe-instance-attribute instance_id --ramdisk
    PROMPT>  ec2-describe-instance-attribute instance_id --instance-type
    PROMPT>  ec2-describe-instance-attribute instance_id --user-data

    Following is a sample response from the first command in the preceding list.

    kernel  i-87ad5eec      aki-94c527fd
  2. Choose one of the following commands to modify the value of the attribute of interest.

    PROMPT>  ec2-modify-instance-attribute instance_id --kernel kernel_id
    PROMPT>  ec2-modify-instance-attribute instance_id --ramdisk ramdisk_id
    PROMPT>  ec2-modify-instance-attribute instance_id --instance-type instance_type
    PROMPT>  ec2-modify-instance-attribute instance_id --user-data user_data

    When you restart the instance, the new attribute value takes effect.

API

You can modify only a single attribute in each call.

To change an attribute of a stopped instance

  1. Issue the following Query request to first get the current value of the attribute of interest. The example gets the current value for the instance type.

    https://ec2.amazonaws.com/
    ?Action=DescribeInstanceAttribute
    &InstanceId=i-87ad5eec
    &Attribute=instanceType
    &...auth parameters...

    For information about the auth parameters, go to Common Query Parameters in the Amazon Elastic Compute Cloud API Reference.

    Following is an example response.

    <DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2012-04-01/">
        <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
       <instanceId>i-5d7e8e36</instanceId>
       <instanceType>
          <value>m1.small</value>
       </instanceType>
    </DescribeInstanceAttributeResponse>
  2. Issue the following Query request to modify the attribute of interest. The example changes the instance type to c1.medium.

    https://ec2.amazonaws.com/
    ?Action=ModifyInstanceAttribute
    &InstanceId=i-87ad5eec
    &Attribute=instanceType
    &Value=c1.medium
    &...auth parameters...

    Following is an example response.

    <ModifyInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2012-04-01/">
       <return>true</return>
    </ModifyInstanceAttributeResponse>