Class: AWSCDK::EC2::CfnLaunchTemplate::BlockDeviceMappingProperty

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

Overview

Specifies a block device mapping for a launch template.

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

BlockDeviceMapping is a property of AWS::EC2::LaunchTemplate LaunchTemplateData .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_name: nil, ebs: nil, no_device: nil, virtual_name: nil) ⇒ BlockDeviceMappingProperty

Returns a new instance of BlockDeviceMappingProperty.

Parameters:

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

    The device name (for example, /dev/sdh or xvdh).

  • ebs (AWSCDK::IResolvable, AWSCDK::EC2::CfnLaunchTemplate::EbsProperty, nil) (defaults to: nil)

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

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

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

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

    The virtual device name (ephemeralN).



774
775
776
777
778
779
780
781
782
783
# File 'ec2/cfn_launch_template.rb', line 774

def initialize(device_name: nil, 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") unless @device_name.nil?
  @ebs = ebs.is_a?(Hash) ? ::AWSCDK::EC2::CfnLaunchTemplate::EbsProperty.new(**ebs.transform_keys(&:to_sym)) : ebs
  Jsii::Type.check_type(@ebs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuTGF1bmNoVGVtcGxhdGUuRWJzUHJvcGVydHkifV19fQ==")), "ebs") unless @ebs.nil?
  @no_device = no_device
  Jsii::Type.check_type(@no_device, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "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 example, /dev/sdh or xvdh).



789
790
791
# File 'ec2/cfn_launch_template.rb', line 789

def device_name
  @device_name
end

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

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



794
795
796
# File 'ec2/cfn_launch_template.rb', line 794

def ebs
  @ebs
end

#no_deviceString? (readonly)

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



799
800
801
# File 'ec2/cfn_launch_template.rb', line 799

def no_device
  @no_device
end

#virtual_nameString? (readonly)

The virtual device name (ephemeralN).

Instance store volumes are numbered starting from 0. 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.



806
807
808
# File 'ec2/cfn_launch_template.rb', line 806

def virtual_name
  @virtual_name
end

Class Method Details

.jsii_propertiesObject



808
809
810
811
812
813
814
815
# File 'ec2/cfn_launch_template.rb', line 808

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

Instance Method Details

#to_jsiiObject



817
818
819
820
821
822
823
824
825
826
# File 'ec2/cfn_launch_template.rb', line 817

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