AWS CloudFormation
User Guide (Version )

AWS::EC2::Instance BlockDeviceMapping

Specifies a block device mapping for an instance.

BlockDeviceMapping is a property of the AWS::EC2::Instance resource.


To declare this entity in your AWS CloudFormation template, use the following syntax:


{ "DeviceName" : String, "Ebs" : Ebs, "NoDevice" : NoDevice, "VirtualName" : String }


DeviceName: String Ebs: Ebs NoDevice: NoDevice VirtualName: String



The device name (for example, /dev/sdh or xvdh).

Required: Yes

Type: String

Update requires: No interruption


Parameters used to automatically set up EBS volumes when the instance is launched.

You can specify either VirtualName or Ebs, but not both.

Required: Conditional

Type: Ebs

Update requires: No interruption


Suppresses the specified device included in the block device mapping of the AMI.

Required: No

Type: NoDevice

Update requires: No interruption


The virtual device name (ephemeralN). The name must be in the form ephemeralX where X is a number starting from zero (0). For example, an instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1. The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

NVMe instance store volumes are automatically enumerated and assigned a device name. Including them in your block device mapping has no effect.

You can specify either VirtualName or Ebs, but not both.

Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

Required: Conditional

Type: String

Update requires: No interruption


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:


"BlockDeviceMappings" : [ { "DeviceName":"/dev/sde", "NoDevice": {} } ]

See Also