Class: AWSCDK::EC2::VolumeProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/volume_props.rb

Overview

Properties of an EBS Volume.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(availability_zone:, auto_enable_io: nil, enable_multi_attach: nil, encrypted: nil, encryption_key: nil, iops: nil, removal_policy: nil, size: nil, snapshot_id: nil, throughput: nil, volume_initialization_rate: nil, volume_name: nil, volume_type: nil) ⇒ VolumeProps

Returns a new instance of VolumeProps.

Parameters:

  • availability_zone (String)

    The Availability Zone in which to create the volume.

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

    Indicates whether the volume is auto-enabled for I/O operations.

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

    Indicates whether Amazon EBS Multi-Attach is enabled.

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

    Specifies whether the volume should be encrypted.

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

    The customer-managed encryption key that is used to encrypt the Volume.

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

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

  • removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    Policy to apply when the volume is removed from the stack.

  • size (AWSCDK::Size, nil) (defaults to: nil)

    The size of the volume, in GiBs.

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

    The snapshot from which to create the volume.

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

    The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 2000.

  • volume_initialization_rate (AWSCDK::Size, nil) (defaults to: nil)

    Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), at which to download the snapshot blocks from Amazon S3 to the volume.

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

    The value of the physicalName property of this resource.

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

    The type of the volume;



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'ec2/volume_props.rb', line 20

def initialize(availability_zone:, auto_enable_io: nil, enable_multi_attach: nil, encrypted: nil, encryption_key: nil, iops: nil, removal_policy: nil, size: nil, snapshot_id: nil, throughput: nil, volume_initialization_rate: nil, volume_name: nil, volume_type: nil)
  @availability_zone = availability_zone
  Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone")
  @auto_enable_io = auto_enable_io
  Jsii::Type.check_type(@auto_enable_io, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "autoEnableIo") unless @auto_enable_io.nil?
  @enable_multi_attach = enable_multi_attach
  Jsii::Type.check_type(@enable_multi_attach, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableMultiAttach") unless @enable_multi_attach.nil?
  @encrypted = encrypted
  Jsii::Type.check_type(@encrypted, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "encrypted") unless @encrypted.nil?
  @encryption_key = encryption_key
  Jsii::Type.check_type(@encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "encryptionKey") unless @encryption_key.nil?
  @iops = iops
  Jsii::Type.check_type(@iops, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "iops") unless @iops.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @size = size
  Jsii::Type.check_type(@size, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "size") unless @size.nil?
  @snapshot_id = snapshot_id
  Jsii::Type.check_type(@snapshot_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "snapshotId") unless @snapshot_id.nil?
  @throughput = throughput
  Jsii::Type.check_type(@throughput, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "throughput") unless @throughput.nil?
  @volume_initialization_rate = volume_initialization_rate
  Jsii::Type.check_type(@volume_initialization_rate, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "volumeInitializationRate") unless @volume_initialization_rate.nil?
  @volume_name = volume_name
  Jsii::Type.check_type(@volume_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "volumeName") unless @volume_name.nil?
  @volume_type = volume_type
  Jsii::Type.check_type(@volume_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkVic0RldmljZVZvbHVtZVR5cGUifQ==")), "volumeType") unless @volume_type.nil?
end

Instance Attribute Details

#auto_enable_ioBoolean? (readonly)

Note:

Default: false

Indicates whether the volume is auto-enabled for I/O operations.

By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.

Returns:

  • (Boolean, nil)


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

def auto_enable_io
  @auto_enable_io
end

#availability_zoneString (readonly)

The Availability Zone in which to create the volume.

Returns:

  • (String)


52
53
54
# File 'ec2/volume_props.rb', line 52

def availability_zone
  @availability_zone
end

#enable_multi_attachBoolean? (readonly)

Note:

Default: false

Indicates whether Amazon EBS Multi-Attach is enabled.

See Considerations and limitations for the constraints of multi-attach.

Returns:

  • (Boolean, nil)


69
70
71
# File 'ec2/volume_props.rb', line 69

def enable_multi_attach
  @enable_multi_attach
end

#encryptedBoolean? (readonly)

Note:

Default: false

Specifies whether the volume should be encrypted.

The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by Default in the Amazon Elastic Compute Cloud User Guide.

Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types.

Returns:

  • (Boolean, nil)


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

def encrypted
  @encrypted
end

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

Note:

Default: - The default KMS key for the account, region, and EC2 service is used.

The customer-managed encryption key that is used to encrypt the Volume.

The encrypted property must be true if this is provided.

Note: If using an aws-kms.IKey created from a aws-kms.Key.fromKeyArn() here, then the KMS key must have the following in its Key policy; otherwise, the Volume will fail to create.

{
  "Effect": "Allow",
  "Principal": { "AWS": "<arn for your account-user> ex: arn:aws:iam::00000000000:root" },
  "Resource": "*",
  "Action": [
    "kms:DescribeKey",
    "kms:GenerateDataKeyWithoutPlainText",
  ],
  "Condition": {
    "StringEquals": {
      "kms:ViaService": "ec2.<Region>.amazonaws.com", (eg: ec2.us-east-1.amazonaws.com)
      "kms:CallerAccount": "0000000000" (your account ID)
    }
  }
}

Returns:



112
113
114
# File 'ec2/volume_props.rb', line 112

def encryption_key
  @encryption_key
end

#iopsNumeric? (readonly)

Note:

Default: None -- Required for io1 and io2 volumes. The default for gp3 volumes is 3,000 IOPS if omitted.

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

The maximum ratio is 50 IOPS/GiB for PROVISIONED_IOPS_SSD, and 500 IOPS/GiB for both PROVISIONED_IOPS_SSD_IO2 and GENERAL_PURPOSE_SSD_GP3. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html for more information.

This parameter is valid only for PROVISIONED_IOPS_SSD, PROVISIONED_IOPS_SSD_IO2 and GENERAL_PURPOSE_SSD_GP3 volumes.

Returns:

  • (Numeric, nil)


124
125
126
# File 'ec2/volume_props.rb', line 124

def iops
  @iops
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.RETAIN

Policy to apply when the volume is removed from the stack.

Returns:



129
130
131
# File 'ec2/volume_props.rb', line 129

def removal_policy
  @removal_policy
end

#sizeAWSCDK::Size? (readonly)

Note:

Default: - If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

The size of the volume, in GiBs.

You must specify either a snapshot ID or a volume size. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html for details on the allowable size for each type of volume.

Returns:



138
139
140
# File 'ec2/volume_props.rb', line 138

def size
  @size
end

#snapshot_idString? (readonly)

Note:

Default: - The EBS volume is not created from a snapshot.

The snapshot from which to create the volume.

You must specify either a snapshot ID or a volume size.

Returns:

  • (String, nil)


145
146
147
# File 'ec2/volume_props.rb', line 145

def snapshot_id
  @snapshot_id
end

#throughputNumeric? (readonly)

Note:

Default: - 125 MiB/s. Only valid on gp3 volumes.

The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 2000.



151
152
153
# File 'ec2/volume_props.rb', line 151

def throughput
  @throughput
end

#volume_initialization_rateAWSCDK::Size? (readonly)

Note:

Default: undefined - The volume initialization rate is not set.

Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), at which to download the snapshot blocks from Amazon S3 to the volume.

Valid range is between 100 and 300 MiB/s.

This parameter is supported only for volumes created from snapshots.



161
162
163
# File 'ec2/volume_props.rb', line 161

def volume_initialization_rate
  @volume_initialization_rate
end

#volume_nameString? (readonly)

Note:

Default: - The physical name will be allocated by CloudFormation at deployment time

The value of the physicalName property of this resource.

Returns:

  • (String, nil)


166
167
168
# File 'ec2/volume_props.rb', line 166

def volume_name
  @volume_name
end

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

Note:

Default: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD

The type of the volume;

what type of storage to use to form the EBS Volume.



173
174
175
# File 'ec2/volume_props.rb', line 173

def volume_type
  @volume_type
end

Class Method Details

.jsii_propertiesObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'ec2/volume_props.rb', line 175

def self.jsii_properties
  {
    :availability_zone => "availabilityZone",
    :auto_enable_io => "autoEnableIo",
    :enable_multi_attach => "enableMultiAttach",
    :encrypted => "encrypted",
    :encryption_key => "encryptionKey",
    :iops => "iops",
    :removal_policy => "removalPolicy",
    :size => "size",
    :snapshot_id => "snapshotId",
    :throughput => "throughput",
    :volume_initialization_rate => "volumeInitializationRate",
    :volume_name => "volumeName",
    :volume_type => "volumeType",
  }
end

Instance Method Details

#to_jsiiObject



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'ec2/volume_props.rb', line 193

def to_jsii
  result = {}
  result.merge!({
    "availabilityZone" => @availability_zone,
    "autoEnableIo" => @auto_enable_io,
    "enableMultiAttach" => @enable_multi_attach,
    "encrypted" => @encrypted,
    "encryptionKey" => @encryption_key,
    "iops" => @iops,
    "removalPolicy" => @removal_policy,
    "size" => @size,
    "snapshotId" => @snapshot_id,
    "throughput" => @throughput,
    "volumeInitializationRate" => @volume_initialization_rate,
    "volumeName" => @volume_name,
    "volumeType" => @volume_type,
  })
  result.compact
end