Amazon EC2 BlockDeviceMapping
The Amazon EC2 block device mapping property is an embedded property of the AWS::EC2::Instance resource. For block device mappings for an Auto Scaling launch configuration, see Amazon EC2 Auto Scaling LaunchConfiguration BlockDeviceMapping.
Syntax
JSON
{ "DeviceName" :String, "Ebs" :EC2 EBS Block Device, "NoDevice" :Boolean, "VirtualName" :String}
YAML
DeviceName:StringEbs:EC2 EBS Block DeviceNoDevice:BooleanVirtualName:String
Properties
DeviceName-
The name of the device within Amazon EC2. For more information, see Device Naming on Linux Instances in the Amazon EC2 User Guide for Linux Instances.
Required: Yes
Type: String
Ebs-
Required: Conditional You can specify either
VirtualNameorEbs, but not both. NoDevice-
This property can be used to unmap a defined device.
Required: No
Type: Boolean
VirtualName-
The name of the virtual device. The name must be in the form
ephemeralwhereXXis a number starting from zero (0); for example,ephemeral0.Required: Conditional You can specify either
VirtualNameorEbs, but not both.Type: String
Examples
Block Device Mapping with two EBS Volumes
This example sets the EBS-backed root device (/dev/sda1) size to 50 GiB, and another EBS-backed device mapped to /dev/sdm that is 100 GiB in size.
"BlockDeviceMappings" : [ { "DeviceName" : "/dev/sda1", "Ebs" : { "VolumeSize" : "50" } }, { "DeviceName" : "/dev/sdm", "Ebs" : { "VolumeSize" : "100" } } ]
Block Device Mapping with an Ephemeral Drive
This example maps an ephemeral drive to device /dev/sdc.
"BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "VirtualName" : "ephemeral0" } ]
Unmapping an AMI-defined Device
To unmap a device defined in the AMI, set the NoDevice property to an empty
map, as shown here:
{ "DeviceName":"/dev/sde", "NoDevice": {} }
See Also
-
Amazon EC2 Instance Store in the Amazon Elastic Compute Cloud User Guide
