ec2-register

Description

Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To launch instances, use the RunInstances operation.

Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through this operation. If needed, you can deregister an AMI at any time.

[Note]Note

AMIs backed by Amazon EBS are automatically registered when you create the image. However, you can use this to register a snapshot of an instance backed by Amazon EBS.

Amazon EBS snapshots are not guaranteed to be bootable. For information on creating AMIs backed by Amazon EBS, go to the Amazon Elastic Compute Cloud Developer Guide or Amazon Elastic Compute Cloud User Guide.

Any modifications to an AMI backed by Amazon S3 invalidates this registration. If you make changes to an image, deregister the previous image and register the new image.

Syntax

ec2-register [manifest] -n name [-a architecture] [-b mapping [-b mapping]] [-d description] [-s snapshot_id] [--kernel kernel_id] [--ramdisk ramdisk_id] [--root-device-name name]

Options

NameDescriptionRequired

manifest

Full path to your AMI manifest in Amazon S3 storage.

Type: String

Default: None

Example: mybucket/image.manifest.xml

No

-n, --name name

The name of the AMI that was provided during image creation.

Type: String

Default: None

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

Example: Standard Web Server

No

-d, --description description

The description of the AMI.

Type: String

Default: None

Constraints: Up to 255 characters.

Example: Standard Web Server AMI

No

--architecture architecture

The architecture of the image.

Type: String

Valid Values: i386 | x86_64

Default: None

Example:

No

--kernel

The ID of the kernel to select.

Type: String

Default: None

Example: aki-ba3adfd3

No

--ramdisk

The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information on whether you need to specify a RAM disk. To find kernel requirements, refer to the Resource Center and search for the kernel ID.

Type: String

Default: None

Example: ari-badbad00

No

--root-device-name name

The root device name (e.g., /dev/sda1).

Type: String

Default: None

Example:

No

--block-device-mapping mapping

The device name (e.g., /dev/sdh).

Type: String

Default: None

Example: /dev/sdh

No

--block-device-mapping mapping

The virtual device name.

Type: String

Default: None

Example:

No

--snapshot snapshot

The ID of the snapshot.

Type: String

Default: None

Example: snap-78a54011

No

--size size

The size of the volume, in GiBs. Required if you are not creating a volume from a snapshot.

Type: Integer

Default: None

Example: 10

No

--delete-on-termination

Specifies whether the Amazon EBS volume is deleted on instance termination.

Type: Boolean

Default: true

Example: --delete-on-termination

No

Output

The command returns a table that contains the following information:

  • IMAGE identifier

  • Unique ID of the newly registered machine image

Amazon EC2 displays errors on stderr.

Examples

Example Request

This example registers the AMI specified in the image.manifest.xml manifest file.

PROMPT> ec2-register mybucket/image.manifest.xml
IMAGE ami-78a54011

Example Request

This example registers an Amazon EBS snapshot to create an AMI backed by Amazon EBS.

PROMPT> ec2-register -n MyImage -s snap-65e34ab22
IMAGE ami-78a54023

Example Request

This example registers the AMI with an Amazon EBS snapshot as the root device, a separate snapshot as a secondary device, and an empty 100 GiB Amazon EBS volume as a storage device.

PROMPT> ec2-register -n MyImage -s snap-6e3ad879 -b /dev/sdb=snap-823ea6df -b
							/dev/sdc=:100
IMAGE ami-78a54043