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...

CreateImage

Description

Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped. For more information about Amazon EBS-backed AMIs, see Storage for the Root Device.

Note

If you customized your instance with instance store volumes or EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes.

Request Parameters

InstanceId

The ID of the instance.

Type: String

Default: None

Required: Yes

Name

A name for the new image.

Type: String

Default: None

Constraints: 3-128 alphanumeric characters, parenthesis (()), commas (,), slashes (/), dashes (-), or underscores(_)

Required: Yes

Description

A description of the new image.

Type: String

Default: None

Constraints: Up to 255 characters

Required: No

NoReboot

By default this parameter is set to false, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and then reboots the instance. When the parameter is set to true, Amazon EC2 does not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.

Type: Boolean

Default: false

Required: No

BlockDeviceMapping.n.DeviceName

The device name exposed to the instance (for example, /dev/sdh or xvdh). For more information, see Block Device Mapping.

Type: String

Default: None

Required: Conditional

Condition: If you're registering an Amazon EBS-backed AMI from a snapshot, you must specify DeviceName with the root device name (for example, /dev/sda1 or xvda), and BlockDeviceMapping.n.Ebs.SnapshotId with the snapshot ID

BlockDeviceMapping.n.NoDevice

Suppresses a device mapping.

Type: Boolean

Default: true

Required: No

BlockDeviceMapping.n.VirtualName

The name of the virtual device, ephemeral[0..3]. The number of instance store volumes depends on the instance type.

Type: String

Default: None

Required: No

BlockDeviceMapping.n.Ebs.SnapshotId

The ID of the snapshot.

Type: String

Default: None

Required: Conditional

Condition: If you're registering an Amazon EBS-backed AMI from a snapshot, you must at least specify SnapshotId with the snapshot ID, and BlockDeviceMapping.n.DeviceName with the root device name.

BlockDeviceMapping.n.Ebs.VolumeSize

The size of the volume, in GiBs.

Type: Integer

Valid values: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

Required: No

BlockDeviceMapping.n.Ebs.DeleteOnTermination

Whether the volume is deleted on instance termination.

Type: Boolean

Default: true

Required: No

BlockDeviceMapping.n.Ebs.VolumeType

The volume type.

Type: String

Valid values: standard | io1

Default: standard

Required: No

BlockDeviceMapping.n.Ebs.Iops

The number of I/O operations per second (IOPS) that the volume supports.

Type: Integer

Valid values: Range is 100 to 4000.

Default: None

Required: Required when the volume type is io1; not used with standard volumes.

Response Elements

The following elements are returned in a CreateImageResponse element.

requestId

The ID of the request.

Type: xsd:string

imageId

The ID of the AMI.

Type: xsd:string

Examples

Example Request

This example creates an AMI from the i-10a64379 instance.

https://ec2.amazonaws.com/?Action=CreateImage
&Description=Standard+Web+Server+v1.0
&InstanceId=i-10a64379
&Name=standard-web-server-v1.0
&AUTHPARAMS

Example Response

<CreateImageResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
   <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
   <imageId>ami-4fa54026</imageId>
</CreateImageResponse>