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

ModifyInstanceAttribute

Description

Modifies the specified attribute of the specified instance. You can specify only one attribute at a time.

Note

To modify some attributes, the instance must be stopped. For more information, see Modifying Attributes of a Stopped Instance in the Amazon Elastic Compute Cloud User Guide.

Request Parameters

InstanceId

The ID of the instance.

Type: String

Default: None

Required: Yes

InstanceType.Value

Changes the instance type to the specified value. See Available Instance Types for more information. An InvalidInstanceAttributeValue error will be returned if the instance type is not valid.

Type: String

Default: None

Required: No

Kernel.Value

Changes the instance's kernel to the specified value.

Type: String

Default: None

Required: No

Ramdisk.Value

Changes the instance's RAM disk to the specified value.

Type: String

Default: None

Required: No

UserData.Value

Changes the instance's user data to the specified value.

Type: String

Default: None

Required: No

DisableApiTermination.Value

Changes the instance's DisableApiTermination flag to the specified value. A value of true means you can't terminate the instance using the API (i.e., the instance is "locked"); a value of false means you can. You must modify this attribute before you can terminate any "locked" instances using the API.

Type: Boolean

Default: None

Required: No

InstanceInitiatedShutdownBehavior.Value

Changes the instance's InstanceInitiatedShutdownBehavior flag to the specified value.

Type: String

Default: None

Valid values: stop | terminate

Required: No

BlockDeviceMapping.Value

Modifies the DeleteOnTermination attribute for volumes that are currently attached. The volume must be owned by the caller. If no value is specified for DeleteOnTermination, the value defaults to true and the volume is deleted when the instance is terminated.

Note

To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the instance. For more information, see Updating the Block Device Mapping when Launching an Instance in the Amazon Elastic Compute Cloud User Guide.

Type: InstanceBlockDeviceMappingItemType

Default: None

Example:

&BlockDeviceMapping1.DeviceName=/dev/sdh
&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true

Required: No

SourceDestCheck.Value

Enables a network address translation (NAT) instance in a VPC to perform NAT. The attribute controls whether source/destination checking is enabled on the instance. A value of true means checking is enabled, and false means checking is disabled. The value must be false for the instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide.

Type: Boolean

Default: None

Required: No

GroupId.n

[EC2-VPC] Changes the instance's security group. You must specify at least one security group, even if it's just the default security group for the VPC. You must specify the security group ID, not the security group name.

For example, if you want the instance to be in sg-1a1a1a1a and sg-9b9b9b9b, specify GroupId.1=sg-1a1a1a1a and GroupId.2=sg-9b9b9b9b.

Type: String

Default: None

Required: No

EbsOptimized

Whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

Type: Boolean

Default: false

Required: No

Response Elements

The following elements are returned in a ModifyInstanceAttributeResponse element.

requestId

The ID of the request.

Type: xsd:string

return

Returns true if the request succeeds. Otherwise, returns an error.

Type: xsd:boolean

Examples

Example Request

This example changes the kernel for the instance.

https://ec2.amazonaws.com/?Action=ModifyInstanceAttribute
&InstanceId=i-10a64379
&Kernel.Value=aki-f70657b2
&AUTHPARAMS

Example Response

<ModifyInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
  <return>true</return>
</ModifyInstanceAttributeResponse>