BlockDeviceVolume
- class aws_cdk.aws_ec2.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 ec2.Instance(self, "Instance", vpc=vpc, instance_type=instance_type, machine_image=machine_image, # ... block_devices=[ec2.BlockDevice( device_name="/dev/sda1", volume=ec2.BlockDeviceVolume.ebs(50) ), ec2.BlockDevice( device_name="/dev/sdm", volume=ec2.BlockDeviceVolume.ebs(100) ) ] )
- 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, kms_key=None, delete_on_termination=None, iops=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: falsekms_key (
Optional
[IKey
]) – The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. You have to ensure that the KMS CMK has the correct permissions to be used by the service launching the ec2 instances. Default: - If encrypted is true, the default aws/ebs KMS key will be used.delete_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 for {@link volumeType}: {@link 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 for {@link EbsDeviceVolumeType.IO1}volume_type (
Optional
[EbsDeviceVolumeType
]) – The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
- Return type:
- classmethod ebs_from_snapshot(snapshot_id, *, volume_size=None, delete_on_termination=None, iops=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 for {@link volumeType}: {@link 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 for {@link EbsDeviceVolumeType.IO1}volume_type (
Optional
[EbsDeviceVolumeType
]) – The EBS volume type. Default: {@link 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: