Class: AWSCDK::EC2::EbsDeviceProps

Inherits:
EbsDeviceSnapshotOptions
  • Object
show all
Defined in:
ec2/ebs_device_props.rb

Overview

Properties of an EBS block device.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delete_on_termination: nil, iops: nil, throughput: nil, volume_type: nil, volume_size: nil, encrypted: nil, kms_key: nil, snapshot_id: nil) ⇒ EbsDeviceProps

Returns a new instance of EbsDeviceProps.

Parameters:

  • delete_on_termination (Boolean, nil) (defaults to: nil)

    Indicates whether to delete the volume when the instance is terminated.

  • iops (Numeric, nil) (defaults to: nil)

    The number of I/O operations per second (IOPS) to provision for the volume.

  • throughput (Numeric, nil) (defaults to: nil)

    The throughput to provision for a gp3 volume.

  • volume_type (AWSCDK::EC2::EbsDeviceVolumeType, nil) (defaults to: nil)

    The EBS volume type.

  • volume_size (Numeric, nil) (defaults to: nil)

    The volume size, in Gibibytes (GiB).

  • encrypted (Boolean, nil) (defaults to: nil)

    Specifies whether the EBS volume is encrypted.

  • kms_key (AWSCDK::KMS::IKey, nil) (defaults to: nil)

    The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption.

  • snapshot_id (String, nil) (defaults to: nil)

    The snapshot ID of the volume to use.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'ec2/ebs_device_props.rb', line 16

def initialize(delete_on_termination: nil, iops: nil, throughput: nil, volume_type: nil, volume_size: nil, encrypted: nil, kms_key: nil, snapshot_id: nil)
  @delete_on_termination = delete_on_termination
  Jsii::Type.check_type(@delete_on_termination, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deleteOnTermination") unless @delete_on_termination.nil?
  @iops = iops
  Jsii::Type.check_type(@iops, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "iops") unless @iops.nil?
  @throughput = throughput
  Jsii::Type.check_type(@throughput, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "throughput") unless @throughput.nil?
  @volume_type = volume_type
  Jsii::Type.check_type(@volume_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkVic0RldmljZVZvbHVtZVR5cGUifQ==")), "volumeType") unless @volume_type.nil?
  @volume_size = volume_size
  Jsii::Type.check_type(@volume_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "volumeSize") unless @volume_size.nil?
  @encrypted = encrypted
  Jsii::Type.check_type(@encrypted, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "encrypted") unless @encrypted.nil?
  @kms_key = kms_key
  Jsii::Type.check_type(@kms_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "kmsKey") unless @kms_key.nil?
  @snapshot_id = snapshot_id
  Jsii::Type.check_type(@snapshot_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "snapshotId") unless @snapshot_id.nil?
end

Instance Attribute Details

#delete_on_terminationBoolean? (readonly)

Note:

Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)

Indicates whether to delete the volume when the instance is terminated.

Returns:

  • (Boolean, nil)


39
40
41
# File 'ec2/ebs_device_props.rb', line 39

def delete_on_termination
  @delete_on_termination
end

#encryptedBoolean? (readonly)

Note:

Default: false

Specifies whether the EBS volume is encrypted.

Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption



82
83
84
# File 'ec2/ebs_device_props.rb', line 82

def encrypted
  @encrypted
end

#iopsNumeric? (readonly)

Note:

Default: - none, required for EbsDeviceVolumeType.IO1

The number of I/O operations per second (IOPS) to provision for the volume.

Must only be set for volume_type: 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.



50
51
52
# File 'ec2/ebs_device_props.rb', line 50

def iops
  @iops
end

#kms_keyAWSCDK::KMS::IKey? (readonly)

Note:

Default: - If encrypted is true, the default aws/ebs KMS key will be used.

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.



90
91
92
# File 'ec2/ebs_device_props.rb', line 90

def kms_key
  @kms_key
end

#snapshot_idString? (readonly)

Note:

Default: - No snapshot will be used

The snapshot ID of the volume to use.

Returns:

  • (String, nil)


95
96
97
# File 'ec2/ebs_device_props.rb', line 95

def snapshot_id
  @snapshot_id
end

#throughputNumeric? (readonly)

Note:

Default: - 125 MiB/s.

The throughput to provision for a gp3 volume.

Valid Range: Minimum value of 125. Maximum value of 2000.

gp3 volumes deliver a consistent baseline throughput performance of 125 MiB/s. You can provision additional throughput for an additional cost at a ratio of 0.25 MiB/s per provisioned IOPS.



61
62
63
# File 'ec2/ebs_device_props.rb', line 61

def throughput
  @throughput
end

#volume_sizeNumeric? (readonly)

Note:

Default: - The snapshot size

The volume size, in Gibibytes (GiB).

If you specify volumeSize, it must be equal or greater than the size of the snapshot.

Returns:

  • (Numeric, nil)


74
75
76
# File 'ec2/ebs_device_props.rb', line 74

def volume_size
  @volume_size
end

#volume_typeAWSCDK::EC2::EbsDeviceVolumeType? (readonly)

Note:

Default: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD or EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3 if @aws-cdk/aws-ec2:ebsDefaultGp3Volume is enabled.

The EBS volume type.



67
68
69
# File 'ec2/ebs_device_props.rb', line 67

def volume_type
  @volume_type
end

Class Method Details

.jsii_propertiesObject



97
98
99
100
101
102
103
104
105
106
107
108
# File 'ec2/ebs_device_props.rb', line 97

def self.jsii_properties
  {
    :delete_on_termination => "deleteOnTermination",
    :iops => "iops",
    :throughput => "throughput",
    :volume_type => "volumeType",
    :volume_size => "volumeSize",
    :encrypted => "encrypted",
    :kms_key => "kmsKey",
    :snapshot_id => "snapshotId",
  }
end

Instance Method Details

#to_jsiiObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'ec2/ebs_device_props.rb', line 110

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "deleteOnTermination" => @delete_on_termination,
    "iops" => @iops,
    "throughput" => @throughput,
    "volumeType" => @volume_type,
    "volumeSize" => @volume_size,
    "encrypted" => @encrypted,
    "kmsKey" => @kms_key,
    "snapshotId" => @snapshot_id,
  })
  result.compact
end