aws-cdk-lib.aws_autoscaling.BlockDeviceVolume

class BlockDeviceVolume

LanguageType name
.NETAmazon.CDK.AWS.AutoScaling.BlockDeviceVolume
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#BlockDeviceVolume
Javasoftware.amazon.awscdk.services.autoscaling.BlockDeviceVolume
Pythonaws_cdk.aws_autoscaling.BlockDeviceVolume
TypeScript (source)aws-cdk-lib » aws_autoscaling » BlockDeviceVolume

Describes a block device mapping for an EC2 instance or Auto Scaling group.

Example

declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
declare const machineImage: ec2.IMachineImage;

const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', {
  vpc,
  instanceType,
  machineImage,
  blockDevices: [
    {
        deviceName: 'gp3-volume',
        volume: autoscaling.BlockDeviceVolume.ebs(15, {
          volumeType: autoscaling.EbsDeviceVolumeType.GP3,
          throughput: 125,
        }),
      },
  ],
  // ...
});

Initializer (protected)

super(ebsDevice?: EbsDeviceProps, virtualName?: string)

Parameters

  • ebsDevice EbsDeviceProps — EBS device info.
  • virtualName string — Virtual device name.

Properties

NameTypeDescription
ebsDevice?EbsDevicePropsEBS device info.
virtualName?stringVirtual device name.

ebsDevice?

Type: EbsDeviceProps (optional)

EBS device info.


virtualName?

Type: string (optional)

Virtual device name.

Methods

NameDescription
static ebs(volumeSize, options?)Creates a new Elastic Block Storage device.
static ebsFromSnapshot(snapshotId, options?)Creates a new Elastic Block Storage device from an existing snapshot.
static ephemeral(volumeIndex)Creates a virtual, ephemeral device.
static noDevice()Supresses a volume mapping.

static ebs(volumeSize, options?)

public static ebs(volumeSize: number, options?: EbsDeviceOptions): BlockDeviceVolume

Parameters

  • volumeSize number — The volume size, in Gibibytes (GiB).
  • options EbsDeviceOptions — additional device options.

Returns

  • BlockDeviceVolume

Creates a new Elastic Block Storage device.


static ebsFromSnapshot(snapshotId, options?)

public static ebsFromSnapshot(snapshotId: string, options?: EbsDeviceSnapshotOptions): BlockDeviceVolume

Parameters

  • snapshotId string — The snapshot ID of the volume to use.
  • options EbsDeviceSnapshotOptions — additional device options.

Returns

  • BlockDeviceVolume

Creates a new Elastic Block Storage device from an existing snapshot.


static ephemeral(volumeIndex)

public static ephemeral(volumeIndex: number): BlockDeviceVolume

Parameters

  • volumeIndex number — the volume index.

Returns

  • BlockDeviceVolume

Creates a virtual, ephemeral device.

The name will be in the form ephemeral{volumeIndex}.


static noDevice()

public static noDevice(): BlockDeviceVolume

Returns

  • BlockDeviceVolume

Supresses a volume mapping.