Each AMI has a block device mapping that specifies the block devices to attach to an instance when it is launched from the AMI. To add more block devices to an AMI, you must create your own AMI.
Contents
Specify a block device mapping for an AMI
There are two ways to specify volumes in addition to the root volume when you create an AMI. If you've already attached volumes to a running instance before you create an AMI from the instance, the block device mapping for the AMI includes those same volumes. For EBS volumes, the existing data is saved to a new snapshot, and it's this new snapshot that's specified in the block device mapping. For instance store volumes, the data is not preserved.
For an EBS-backed AMI, you can add EBS volumes and instance store volumes using a block device mapping. For an instance store-backed AMI, you can add instance store volumes only by modifying the block device mapping entries in the image manifest file when registering the image.
Note
For M3 instances, you must specify instance store volumes in the block device mapping for the instance when you launch it. When you launch an M3 instance, instance store volumes specified in the block device mapping for the AMI may be ignored if they are not specified as part of the instance block device mapping.
To add volumes to an AMI using the console
-
Open the Amazon EC2 console.
-
In the navigation pane, choose Instances.
-
Select an instance and choose Actions, Image and templates, Create image.
-
Enter a name and a description for the image.
-
The instance volumes appear under Instance volumes. To add another volume, choose Add volume.
-
For Volume type, choose the volume type. For Device choose the device name. For an EBS volume, you can specify additional details, such as a snapshot, volume size, volume type, IOPS, and encryption state.
-
Choose Create image.
View the EBS volumes in an AMI block device mapping
You can easily enumerate the EBS volumes in the block device mapping for an AMI.
To view the EBS volumes for an AMI using the console
-
Open the Amazon EC2 console.
-
In the navigation pane, choose AMIs.
-
Choose EBS images from the Filter list to get a list of EBS-backed AMIs.
-
Select the desired AMI, and look at the Details tab. At a minimum, the following information is available for the root device:
-
Root Device Type (
ebs
) -
Root Device Name (for example,
/dev/sda1
) -
Block Devices (for example,
/dev/sda1=snap-1234567890abcdef0:8:true
)
If the AMI was created with additional EBS volumes using a block device mapping, the Block Devices field displays the mapping for those additional volumes as well. (This screen doesn't display instance store volumes.)
-