Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

Amazon EC2 Block Device Mapping Property

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 AutoScaling Block Device Mapping.

Syntax

JSON

Copy
{ "DeviceName" : String, "Ebs" : EC2 EBS Block Device, "NoDevice" : Boolean, "VirtualName" : String }

YAML

Copy
DeviceName: String Ebs: EC2 EBS Block Device NoDevice: Boolean VirtualName: 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 VirtualName or Ebs, but not both.

Type: Amazon Elastic Block Store Block Device Property.

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 ephemeralX where X is a number starting from zero (0); for example, ephemeral0.

Required: Conditional You can specify either VirtualName or Ebs, 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.

Copy
"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.

Copy
"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:

Copy
{ "DeviceName":"/dev/sde", "NoDevice": {} }

See Also