Create Image operation for the Amazon EC2 REST adapter
The Create Image operation creates an Amazon Machine Image (AMI) that uses an Amazon Elastic Block Store (EBS) root device from a running or stopped instance.
The following figure shows a sample <items>
XML element for the Create Image operation:
<items>
<item>
<parameters>
<instance-id></instance-id>
<name></name>
<!-Optional:->
<description></description>
<!-Optional:->
<no-reboot></no-reboot>
<block-device-mapping>
<item>
<device-name></device-name>
<!- Specify any one of the following three.->
<ebs>
<snapshot-id></snapshot-id>
<volume-size></volume-size>
<volume-type></volume-type>
<iops></iops>
<delete-on-termination></delete-on-termination>
</ebs>
<no-device></no-device>
<virtual-name></virtual-name>
</item>
</block-device-mapping>
</parameters>
</item>
</items>
The following table shows the adapter request elements for the Create Image operation:
Adapter request elements for the Create Image operation
Element | Definition | Required |
---|---|---|
<access-key> | Specifies the Amazon Web Services (AWS) access key You need to generate the AWS access key by going to the Security Credentials tab in the AWS console. | Conditional;
|
<secret-key> | Specifies the AWS secret access key You need to generate the AWS secret access key by going to the Security Credentials tab in the AWS console. | Conditional;
|
<region> | Specifies the region with which you want the adapter to communicate Amazon EC2 is hosted in multiple locations world-wide. You must specify the region in which you want the adapter to perform the actions. Valid values:
| No |
| Contains the name of the operation: create-image | Yes |
| Contains the ID of the instance | Yes |
| Contains the name of the AMI | Yes |
| Contains the description of the AMI | No |
| Specifies whether Amazon EC2 attempts to cleanly shut down the instance before creating the image and reboots the instance later (when set to false)
| No |
<block-device-mapping> | Specifies how block devices are exposed to the instance Each mapping consists of a deviceName and a blockDevice. | No |
<device-name> | Specifies the name of the physical device on the instance to map For example, /dev/sdh | Conditional; required if you specify the <block-device-mapping> element |
<ebs> | Specifies the parent element that contains the following elements used to set up Amazon EBS volumes to be mapped to the device:
| No Note: You can specify only one of the following elements within the
|
<snapshot-id> | Specifies the snapshot ID based on which a volume is created | No |
<volume-size> | Specifies the volume size that you can use instead of the <snapshot-id> to create an empty Amazon EBS volume | No |
<volume-type> | Specifies the type of the volume Valid values: io1 (To create a Provisioned IOPS volume), standard (default) Note: If the volume type is io1, you can also provision the number of IOPS that the volume supports. | No |
<iops> | Specifies the number of Input/Output operations per second (IOPS) that a volume of type I/O 1 supports | No |
<delete-on-termination> | Specifies whether to prevent the volume from being deleted on termination of the instance Valid values: true (default), false | No |
<no-device> | Specifies the device to suppress during the instance launch | No Note: You can specify only one of the following elements within the
|
<virtual-name> | Specifies an instance store volume to be mapped to the device For example, ephemeral0 | No Note: You can specify only one of the following elements within the
|
The following figure shows a sample adapter request for the Create Image operation:
Sample adapter request for the Create Image operation
<amazon-ec2-rest-request>
<operation-name>create-image</operation-name>
<parameters>
<instance-id>i-65be346c</instance-id>
<name>test image2</name>
<description>Image description new</description>
<no-reboot>false</no-reboot>
<block-device-mapping>
<item>
<device-name>/dev/sda1</device-name>
<ebs>
<snapshot-id />
<volume-size>8</volume-size>
<volume-type>standard</volume-type>
<iops />
<delete-on-termination>true</delete-on-termination>
</ebs>
</item>
</block-device-mapping>
</parameters>
</amazon-ec2-rest-request>
The following figure shows a sample adapter response for the Create Image operation:
Sample adapter response for the Create Image operation
<amazon-ec2-rest-response>
<metadata>
<status>success</status>
</metadata>
<CreateImageResponse>
<ImageInfo>
<imageId>ami-b8cea688</imageId>
</ImageInfo>
</CreateImageResponse>
</amazon-ec2-rest-response>
Comments
Log in or register to comment.