Class: AWSCDK::EC2::CfnInstance::BlockDeviceMappingProperty

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

Overview

Specifies a block device mapping for an instance.

You must specify exactly one of the following properties: VirtualName , Ebs , or NoDevice .

BlockDeviceMapping is a property of the AWS::EC2::Instance resource.

After the instance is running, you can modify only the DeleteOnTermination parameter 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(device_name:, ebs: nil, no_device: nil, virtual_name: nil) ⇒ BlockDeviceMappingProperty

Returns a new instance of BlockDeviceMappingProperty.

Parameters:



1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
# File 'ec2/cfn_instance.rb', line 1183

def initialize(device_name:, ebs: nil, no_device: nil, virtual_name: nil)
  @device_name = device_name
  Jsii::Type.check_type(@device_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "deviceName")
  @ebs = ebs.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::EbsProperty.new(**ebs.transform_keys(&:to_sym)) : ebs
  Jsii::Type.check_type(@ebs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuRWJzUHJvcGVydHkifV19fQ==")), "ebs") unless @ebs.nil?
  @no_device = no_device.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::NoDeviceProperty.new(**no_device.transform_keys(&:to_sym)) : no_device
  Jsii::Type.check_type(@no_device, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuTm9EZXZpY2VQcm9wZXJ0eSJ9XX19")), "noDevice") unless @no_device.nil?
  @virtual_name = virtual_name
  Jsii::Type.check_type(@virtual_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "virtualName") unless @virtual_name.nil?
end

Instance Attribute Details

#device_nameString (readonly)

The device name. For available device names, see Device names for volumes .

After the instance is running, this parameter is used to specify the device name of the block device mapping to update.



1200
1201
1202
# File 'ec2/cfn_instance.rb', line 1200

def device_name
  @device_name
end

#ebsAWSCDK::IResolvable, ... (readonly)

Parameters used to automatically set up EBS volumes when the instance is launched.

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



1207
1208
1209
# File 'ec2/cfn_instance.rb', line 1207

def ebs
  @ebs
end

#no_deviceAWSCDK::IResolvable, ... (readonly)

To omit the device from the block device mapping, specify an empty string.

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



1214
1215
1216
# File 'ec2/cfn_instance.rb', line 1214

def no_device
  @no_device
end

#virtual_nameString? (readonly)

The virtual device name ( ephemeral N).

The name must be in the form ephemeral X where X is a number starting from zero (0). For example, an instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 . The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

NVMe instance store volumes are automatically enumerated and assigned a device name. Including them in your block device mapping has no effect.

Constraints : For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

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



1227
1228
1229
# File 'ec2/cfn_instance.rb', line 1227

def virtual_name
  @virtual_name
end

Class Method Details

.jsii_propertiesObject



1229
1230
1231
1232
1233
1234
1235
1236
# File 'ec2/cfn_instance.rb', line 1229

def self.jsii_properties
  {
    :device_name => "deviceName",
    :ebs => "ebs",
    :no_device => "noDevice",
    :virtual_name => "virtualName",
  }
end

Instance Method Details

#to_jsiiObject



1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'ec2/cfn_instance.rb', line 1238

def to_jsii
  result = {}
  result.merge!({
    "deviceName" => @device_name,
    "ebs" => @ebs,
    "noDevice" => @no_device,
    "virtualName" => @virtual_name,
  })
  result.compact
end