Class: AWSCDK::EC2::CfnInstance::EbsProperty

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

Overview

Specifies a block device for an EBS volume.

Ebs is a property of the BlockDeviceMapping property type.

After the instance is running, you can modify only the DeleteOnTermination parameters for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delete_on_termination: nil, encrypted: nil, iops: nil, kms_key_id: nil, snapshot_id: nil, volume_size: nil, volume_type: nil) ⇒ EbsProperty

Returns a new instance of EbsProperty.

Parameters:

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

    Indicates whether the EBS volume is deleted on instance termination.

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

    Indicates whether the volume should be encrypted.

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

    The number of I/O operations per second (IOPS).

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

    The identifier of the AWS KMS key to use for Amazon EBS encryption.

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

    The ID of the snapshot.

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

    The size of the volume, in GiBs.

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

    The volume type.



1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
# File 'ec2/cfn_instance.rb', line 1357

def initialize(delete_on_termination: nil, encrypted: nil, iops: nil, kms_key_id: nil, snapshot_id: nil, volume_size: nil, volume_type: nil)
  @delete_on_termination = delete_on_termination
  Jsii::Type.check_type(@delete_on_termination, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "deleteOnTermination") unless @delete_on_termination.nil?
  @encrypted = encrypted
  Jsii::Type.check_type(@encrypted, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "encrypted") unless @encrypted.nil?
  @iops = iops
  Jsii::Type.check_type(@iops, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "iops") unless @iops.nil?
  @kms_key_id = kms_key_id
  Jsii::Type.check_type(@kms_key_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kmsKeyId") unless @kms_key_id.nil?
  @snapshot_id = snapshot_id
  Jsii::Type.check_type(@snapshot_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "snapshotId") unless @snapshot_id.nil?
  @volume_size = volume_size
  Jsii::Type.check_type(@volume_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "volumeSize") unless @volume_size.nil?
  @volume_type = volume_type
  Jsii::Type.check_type(@volume_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "volumeType") unless @volume_type.nil?
end

Instance Attribute Details

#delete_on_terminationBoolean, ... (readonly)

Indicates whether the EBS volume is deleted on instance termination.

For more information, see Preserving Amazon EBS volumes on instance termination in the Amazon EC2 User Guide .



1380
1381
1382
# File 'ec2/cfn_instance.rb', line 1380

def delete_on_termination
  @delete_on_termination
end

#encryptedBoolean, ... (readonly)

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

After the instance is running, modifying this parameter results in instance replacement .



1391
1392
1393
# File 'ec2/cfn_instance.rb', line 1391

def encrypted
  @encrypted
end

#iopsNumeric? (readonly)

The number of I/O operations per second (IOPS).

For gp3 , io1 , and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.

The following are the supported values for each volume type:

  • gp3 : 3,000-16,000 IOPS
  • io1 : 100-64,000 IOPS
  • io2 : 100-64,000 IOPS

For io1 and io2 volumes, we guarantee 64,000 IOPS only for Instances built on the Nitro System . Other instance families guarantee performance up to 32,000 IOPS.

This parameter is required for io1 and io2 volumes. The default for gp3 volumes is 3,000 IOPS. This parameter is not supported for gp2 , st1 , sc1 , or standard volumes.

After the instance is running, modifying this parameter results in instance replacement .



1410
1411
1412
# File 'ec2/cfn_instance.rb', line 1410

def iops
  @iops
end

#kms_key_idString? (readonly)

The identifier of the AWS KMS key to use for Amazon EBS encryption.

If KmsKeyId is specified, the encrypted state must be true . If the encrypted state is true but you do not specify KmsKeyId , your KMS key for EBS is used.

You can specify the KMS key using any of the following:

  • Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.
  • Key alias. For example, alias/ExampleAlias.
  • Key ARN. For example, arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab.
  • Alias ARN. For example, arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias.

After the instance is running, modifying this parameter results in instance replacement .



1426
1427
1428
# File 'ec2/cfn_instance.rb', line 1426

def kms_key_id
  @kms_key_id
end

#snapshot_idString? (readonly)

The ID of the snapshot.

If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot.

After the instance is running, modifying this parameter results in instance replacement .



1435
1436
1437
# File 'ec2/cfn_instance.rb', line 1435

def snapshot_id
  @snapshot_id
end

#volume_sizeNumeric? (readonly)

The size of the volume, in GiBs.

You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.

The following are the supported volumes sizes for each volume type:

  • gp2 and gp3 :1-16,384
  • io1 and io2 : 4-16,384
  • st1 and sc1 : 125-16,384
  • standard : 1-1,024

After the instance is running, modifying this parameter results in instance replacement .



1451
1452
1453
# File 'ec2/cfn_instance.rb', line 1451

def volume_size
  @volume_size
end

#volume_typeString? (readonly)

The volume type.

For more information, see Amazon EBS volume types in the Amazon EC2 User Guide . If the volume type is io1 or io2 , you must specify the IOPS that the volume supports.

After the instance is running, modifying this parameter results in instance replacement .



1460
1461
1462
# File 'ec2/cfn_instance.rb', line 1460

def volume_type
  @volume_type
end

Class Method Details

.jsii_propertiesObject



1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
# File 'ec2/cfn_instance.rb', line 1462

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

Instance Method Details

#to_jsiiObject



1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
# File 'ec2/cfn_instance.rb', line 1474

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