Class: AWSCDK::EC2::BlockDevice

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

Overview

Block device.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_name:, volume:, mapping_enabled: nil) ⇒ BlockDevice

Returns a new instance of BlockDevice.

Parameters:

  • device_name (String)

    The device name exposed to the EC2 instance.

  • volume (AWSCDK::EC2::BlockDeviceVolume)

    Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume.

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

    If false, the device mapping will be suppressed.



10
11
12
13
14
15
16
17
# File 'ec2/block_device.rb', line 10

def initialize(device_name:, volume:, mapping_enabled: nil)
  @device_name = device_name
  Jsii::Type.check_type(@device_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "deviceName")
  @volume = volume
  Jsii::Type.check_type(@volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkJsb2NrRGV2aWNlVm9sdW1lIn0=")), "volume")
  @mapping_enabled = mapping_enabled
  Jsii::Type.check_type(@mapping_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "mappingEnabled") unless @mapping_enabled.nil?
end

Instance Attribute Details

#device_nameString (readonly)

The device name exposed to the EC2 instance.

For example, a value like /dev/sdh, xvdh.



25
26
27
# File 'ec2/block_device.rb', line 25

def device_name
  @device_name
end

#mapping_enabledBoolean? (readonly)

Note:

Default: true - device mapping is left untouched

If false, the device mapping will be suppressed.

If set to false for the root device, the instance might fail the Amazon EC2 health check. Amazon EC2 Auto Scaling launches a replacement instance if the instance fails the health check.

Returns:

  • (Boolean, nil)


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

def mapping_enabled
  @mapping_enabled
end

#volumeAWSCDK::EC2::BlockDeviceVolume (readonly)

Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume.

For example, a value like BlockDeviceVolume.ebs(15), BlockDeviceVolume.ephemeral(0).



31
32
33
# File 'ec2/block_device.rb', line 31

def volume
  @volume
end

Class Method Details

.jsii_propertiesObject



41
42
43
44
45
46
47
# File 'ec2/block_device.rb', line 41

def self.jsii_properties
  {
    :device_name => "deviceName",
    :volume => "volume",
    :mapping_enabled => "mappingEnabled",
  }
end

Instance Method Details

#to_jsiiObject



49
50
51
52
53
54
55
56
57
# File 'ec2/block_device.rb', line 49

def to_jsii
  result = {}
  result.merge!({
    "deviceName" => @device_name,
    "volume" => @volume,
    "mappingEnabled" => @mapping_enabled,
  })
  result.compact
end