BlockDeviceVolume
- class aws_cdk.aws_autoscaling.BlockDeviceVolume(ebs_device=None, virtual_name=None)
Bases:
object
Describes a block device mapping for an EC2 instance or Auto Scaling group.
- ExampleMetadata:
infused
Example:
# vpc: ec2.Vpc # instance_type: ec2.InstanceType # machine_image: ec2.IMachineImage auto_scaling_group = autoscaling.AutoScalingGroup(self, "ASG", vpc=vpc, instance_type=instance_type, machine_image=machine_image, block_devices=[autoscaling.BlockDevice( device_name="gp3-volume", volume=autoscaling.BlockDeviceVolume.ebs(15, volume_type=autoscaling.EbsDeviceVolumeType.GP3, throughput=125 ) ) ] )
- Parameters:
ebs_device (
Union
[EbsDeviceProps
,Dict
[str
,Any
],None
]) – EBS device info.virtual_name (
Optional
[str
]) – Virtual device name.
Attributes
- ebs_device
EBS device info.
- virtual_name
Virtual device name.
Static Methods
- classmethod ebs(volume_size, *, encrypted=None, delete_on_termination=None, iops=None, throughput=None, volume_type=None)
Creates a new Elastic Block Storage device.
- Parameters:
volume_size (
Union
[int
,float
]) – The volume size, in Gibibytes (GiB).encrypted (
Optional
[bool
]) – Specifies whether the EBS volume is encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption Default: falsedelete_on_termination (
Optional
[bool
]) – Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)iops (
Union
[int
,float
,None
]) – The number of I/O operations per second (IOPS) to provision for the volume. Must only be set forvolumeType
:EbsDeviceVolumeType.IO1
The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required forEbsDeviceVolumeType.IO1
throughput (
Union
[int
,float
,None
]) – The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. Default: - 125 MiB/s. Only valid on gp3 volumes.volume_type (
Optional
[EbsDeviceVolumeType
]) – The EBS volume type. Default:EbsDeviceVolumeType.GP2
- Return type:
- classmethod ebs_from_snapshot(snapshot_id, *, volume_size=None, delete_on_termination=None, iops=None, throughput=None, volume_type=None)
Creates a new Elastic Block Storage device from an existing snapshot.
- Parameters:
snapshot_id (
str
) – The snapshot ID of the volume to use.volume_size (
Union
[int
,float
,None
]) – The volume size, in Gibibytes (GiB). If you specify volumeSize, it must be equal or greater than the size of the snapshot. Default: - The snapshot sizedelete_on_termination (
Optional
[bool
]) – Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)iops (
Union
[int
,float
,None
]) – The number of I/O operations per second (IOPS) to provision for the volume. Must only be set forvolumeType
:EbsDeviceVolumeType.IO1
The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required forEbsDeviceVolumeType.IO1
throughput (
Union
[int
,float
,None
]) – The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. Default: - 125 MiB/s. Only valid on gp3 volumes.volume_type (
Optional
[EbsDeviceVolumeType
]) – The EBS volume type. Default:EbsDeviceVolumeType.GP2
- Return type:
- classmethod ephemeral(volume_index)
Creates a virtual, ephemeral device.
The name will be in the form ephemeral{volumeIndex}.
- Parameters:
volume_index (
Union
[int
,float
]) – the volume index. Must be equal or greater than 0- Return type:
- classmethod no_device()
Supresses a volume mapping.
- Return type: