Class: AWSCDK::EC2::EbsDeviceOptions

Inherits:
EbsDeviceOptionsBase
  • Object
show all
Defined in:
ec2/ebs_device_options.rb

Overview

Block device options for an EBS volume.

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, encrypted: nil, kms_key: nil) ⇒ EbsDeviceOptions

Returns a new instance of EbsDeviceOptions.

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.

  • 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.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ec2/ebs_device_options.rb', line 13

def initialize(delete_on_termination: nil, iops: nil, throughput: nil, volume_type: nil, encrypted: nil, kms_key: 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?
  @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?
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)


32
33
34
# File 'ec2/ebs_device_options.rb', line 32

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



68
69
70
# File 'ec2/ebs_device_options.rb', line 68

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.



43
44
45
# File 'ec2/ebs_device_options.rb', line 43

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.



76
77
78
# File 'ec2/ebs_device_options.rb', line 76

def kms_key
  @kms_key
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.



54
55
56
# File 'ec2/ebs_device_options.rb', line 54

def throughput
  @throughput
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.



60
61
62
# File 'ec2/ebs_device_options.rb', line 60

def volume_type
  @volume_type
end

Class Method Details

.jsii_propertiesObject



78
79
80
81
82
83
84
85
86
87
# File 'ec2/ebs_device_options.rb', line 78

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

Instance Method Details

#to_jsiiObject



89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'ec2/ebs_device_options.rb', line 89

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