| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Instances have a set of attributes, and you can modify the following attributes only when the instance is stopped:
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), see ec2-modify-instance-attribute in the Amazon Elastic Compute Cloud Command Line Reference.
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 Kernel FAQ.
To change the instance type for a stopped instance
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, click Instances.
In the My Instances pane, right-click a stopped instance, and then click Change Instance Type.
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
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, click Instances.
In the My Instances pane, right-click a stopped instance, and then click View/Change User Data.
In the View/Change User Data dialog box, update the user data, and then click Yes, Change.
You can modify only a single attribute with each command.
To change an attribute of a stopped instance
Choose one of the following commands to get the current value of the attribute of interest.
PROMPT>ec2-describe-instance-attributeinstance_id--kernel
PROMPT>ec2-describe-instance-attributeinstance_id--ramdisk
PROMPT>ec2-describe-instance-attributeinstance_id--instance-type
PROMPT>ec2-describe-instance-attributeinstance_id--user-data
The following is a sample response from the first command in the preceding list.
kernel i-87ad5eec aki-94c527fd
Choose one of the following commands to modify the value of the attribute of interest.
PROMPT>ec2-modify-instance-attributeinstance_id--kernelkernel_id
PROMPT>ec2-modify-instance-attributeinstance_id--ramdiskramdisk_id
PROMPT>ec2-modify-instance-attributeinstance_id--instance-typeinstance_type
PROMPT>ec2-modify-instance-attributeinstance_id--user-datauser_data
When you restart the instance, the new attribute value takes effect.
You can modify only a single attribute in each call.
To change an attribute of a stopped instance
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 &AUTHPARAMS
For information about the auth parameters, see Common Query Parameters in the Amazon EC2 API Reference.
The following is an example response.
<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
<instanceId>i-5d7e8e36</instanceId>
<instanceType>
<value>m1.small</value>
</instanceType>
</DescribeInstanceAttributeResponse>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 &AUTHPARAMS
The following is an example response.
<ModifyInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/"> <return>true</return> </ModifyInstanceAttributeResponse>
Related Topics