To define a block device mapping, set the
block-device-mappingsattribute of the run-instances or register-image command following this syntax:
You can set this attribute either inline (directly in the command), or via a text file (by specifying
MAP_PATHis the path to your block device mapping file).
This attribute contains the following elements that you need to specify:
DeviceName: The device name assigned to the volume
The device name for the root device must be /dev/sda1. For any other volume you must use the /dev/xvdX format. For more information, see About Volumes > Volumes Attachment and Device Names.
Ebs: Information to map a volume to
DeviceName. This element requires the following information:
SnapshotId: The ID of a snapshot if you want to create a volume from it.
VolumeSize: The size of the volume to create, in gibibytes (GiB).
- If you specify a snapshot ID, the volume size must be at least equal to the snapshot size.
- If you specify a snapshot ID but no volume size, the volume is created with a size similar to the snapshot one.
DeleteOnTermination: By default or if set to
true, the volume is deleted when terminating the instance. If
false, the volume is not deleted when terminating the instance.
VolumeType: The type of volume (
io1). For more information, see Volume Types and IOPS. By default, a
standardvolume is created.
Iops: The number of IOPS.
The maximum number of IOPS allowed for
io1volumes is 13000.
This parameter must be specified only if you create an
NoDevice: Prevents a volume from being mapped to
DeviceName, if the OMI used contains a mapping for
To use this parameter, specify any value other than null, for example an empty string ("").
In the following example, the block device mappings:
- Attach a volume created from the snap-123456789 snapshot, assigned to /dev/xvd
- Attach an empty Magnetic volume with a size of 100 GiB, assigned to /dev/xvdc and that is deleted when terminating the instance
- Prevent a volume defined by the OMI from being assigned to /dev/xvde at launch
Skip to end of banner Go to start of banner Skip to end of metadata Go to start of metadata