aws-cdk-lib.aws_ec2.BlockDevice

interface BlockDevice

LanguageType name
.NETAmazon.CDK.AWS.EC2.BlockDevice
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#BlockDevice
Javasoftware.amazon.awscdk.services.ec2.BlockDevice
Pythonaws_cdk.aws_ec2.BlockDevice
TypeScript (source)aws-cdk-lib » aws_ec2 » BlockDevice

Block device.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const blockDeviceVolume: ec2.BlockDeviceVolume;
const blockDevice: ec2.BlockDevice = {
  deviceName: 'deviceName',
  volume: blockDeviceVolume,

  // the properties below are optional
  mappingEnabled: false,
};

Properties

NameTypeDescription
deviceNamestringThe device name exposed to the EC2 instance.
volumeBlockDeviceVolumeDefines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume.
mappingEnabled?booleanIf false, the device mapping will be suppressed.

deviceName

Type: string

The device name exposed to the EC2 instance.

For example, a value like /dev/sdh, xvdh.

See also: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html


volume

Type: BlockDeviceVolume

Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume.

For example, a value like BlockDeviceVolume.ebs(15), BlockDeviceVolume.ephemeral(0).


mappingEnabled?

Type: boolean (optional, default: true - device mapping is left untouched)

If false, the device mapping will be suppressed.

If set to false for the root device, the instance might fail the Amazon EC2 health check. Amazon EC2 Auto Scaling launches a replacement instance if the instance fails the health check.