Class: AWSCDK::Autoscaling::CfnLaunchConfigurationProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
autoscaling/cfn_launch_configuration_props.rb

Overview

Properties for defining a CfnLaunchConfiguration.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image_id:, instance_type:, associate_public_ip_address: nil, block_device_mappings: nil, classic_link_vpc_id: nil, classic_link_vpc_security_groups: nil, ebs_optimized: nil, iam_instance_profile: nil, instance_id: nil, instance_monitoring: nil, kernel_id: nil, key_name: nil, launch_configuration_name: nil, metadata_options: nil, placement_tenancy: nil, ram_disk_id: nil, security_groups: nil, spot_price: nil, user_data: nil) ⇒ CfnLaunchConfigurationProps

Returns a new instance of CfnLaunchConfigurationProps.

Parameters:

  • image_id (String)

    The ID of the Amazon Machine Image (AMI) that was assigned during registration.

  • instance_type (String)

    Specifies the instance type of the EC2 instance.

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

    Specifies whether to assign a public IPv4 address to the group's instances.

  • block_device_mappings (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnLaunchConfiguration::BlockDeviceMappingProperty>, nil) (defaults to: nil)

    The block device mapping entries that define the block devices to attach to the instances at launch.

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

    Available for backward compatibility.

  • classic_link_vpc_security_groups (Array<String>, nil) (defaults to: nil)

    Available for backward compatibility.

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

    Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).

  • iam_instance_profile (String, AWSCDK::Interfaces::AWSIAM::IInstanceProfileRef, nil) (defaults to: nil)

    The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.

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

    The ID of the Amazon EC2 instance to use to create the launch configuration.

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

    Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.

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

    The ID of the kernel associated with the AMI.

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

    The name of the key pair.

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

    The name of the launch configuration.

  • metadata_options (AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnLaunchConfiguration::MetadataOptionsProperty, nil) (defaults to: nil)

    The metadata options for the instances.

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

    The tenancy of the instance, either default or dedicated .

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

    The ID of the RAM disk to select.

  • security_groups (Array<String, AWSCDK::Interfaces::AWSEC2::ISecurityGroupRef>, nil) (defaults to: nil)

    A list that contains the security groups to assign to the instances in the Auto Scaling group.

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

    The maximum hourly price to be paid for any Spot Instance launched to fulfill the request.

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

    The Base64-encoded user data to make available to the launched EC2 instances.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'autoscaling/cfn_launch_configuration_props.rb', line 28

def initialize(image_id:, instance_type:, associate_public_ip_address: nil, block_device_mappings: nil, classic_link_vpc_id: nil, classic_link_vpc_security_groups: nil, ebs_optimized: nil, iam_instance_profile: nil, instance_id: nil, instance_monitoring: nil, kernel_id: nil, key_name: nil, launch_configuration_name: nil, metadata_options: nil, placement_tenancy: nil, ram_disk_id: nil, security_groups: nil, spot_price: nil, user_data: nil)
  @image_id = image_id
  Jsii::Type.check_type(@image_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageId")
  @instance_type = instance_type
  Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceType")
  @associate_public_ip_address = associate_public_ip_address
  Jsii::Type.check_type(@associate_public_ip_address, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "associatePublicIpAddress") unless @associate_public_ip_address.nil?
  @block_device_mappings = block_device_mappings
  Jsii::Type.check_type(@block_device_mappings, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2ZuTGF1bmNoQ29uZmlndXJhdGlvbi5CbG9ja0RldmljZU1hcHBpbmdQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "blockDeviceMappings") unless @block_device_mappings.nil?
  @classic_link_vpc_id = classic_link_vpc_id
  Jsii::Type.check_type(@classic_link_vpc_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "classicLinkVpcId") unless @classic_link_vpc_id.nil?
  @classic_link_vpc_security_groups = classic_link_vpc_security_groups
  Jsii::Type.check_type(@classic_link_vpc_security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "classicLinkVpcSecurityGroups") unless @classic_link_vpc_security_groups.nil?
  @ebs_optimized = ebs_optimized
  Jsii::Type.check_type(@ebs_optimized, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "ebsOptimized") unless @ebs_optimized.nil?
  @iam_instance_profile = iam_instance_profile
  Jsii::Type.check_type(@iam_instance_profile, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSUluc3RhbmNlUHJvZmlsZVJlZiJ9XX19")), "iamInstanceProfile") unless @iam_instance_profile.nil?
  @instance_id = instance_id
  Jsii::Type.check_type(@instance_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceId") unless @instance_id.nil?
  @instance_monitoring = instance_monitoring
  Jsii::Type.check_type(@instance_monitoring, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "instanceMonitoring") unless @instance_monitoring.nil?
  @kernel_id = kernel_id
  Jsii::Type.check_type(@kernel_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kernelId") unless @kernel_id.nil?
  @key_name = key_name
  Jsii::Type.check_type(@key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyName") unless @key_name.nil?
  @launch_configuration_name = launch_configuration_name
  Jsii::Type.check_type(@launch_configuration_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "launchConfigurationName") unless @launch_configuration_name.nil?
  @metadata_options = .is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnLaunchConfiguration::MetadataOptionsProperty.new(**.transform_keys(&:to_sym)) : 
  Jsii::Type.check_type(@metadata_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5MYXVuY2hDb25maWd1cmF0aW9uLk1ldGFkYXRhT3B0aW9uc1Byb3BlcnR5In1dfX0=")), "metadataOptions") unless @metadata_options.nil?
  @placement_tenancy = placement_tenancy
  Jsii::Type.check_type(@placement_tenancy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "placementTenancy") unless @placement_tenancy.nil?
  @ram_disk_id = ram_disk_id
  Jsii::Type.check_type(@ram_disk_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ramDiskId") unless @ram_disk_id.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InVuaW9uIjp7InR5cGVzIjpbeyJwcmltaXRpdmUiOiJzdHJpbmcifSx7ImZxbiI6ImF3cy1jZGstbGliLmludGVyZmFjZXMuYXdzX2VjMi5JU2VjdXJpdHlHcm91cFJlZiJ9XX19LCJraW5kIjoiYXJyYXkifX0=")), "securityGroups") unless @security_groups.nil?
  @spot_price = spot_price
  Jsii::Type.check_type(@spot_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "spotPrice") unless @spot_price.nil?
  @user_data = user_data
  Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "userData") unless @user_data.nil?
end

Instance Attribute Details

#associate_public_ip_addressBoolean, ... (readonly)

Specifies whether to assign a public IPv4 address to the group's instances.

If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet.

If you specify true , each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see Provide network connectivity for your Auto Scaling instances using Amazon VPC in the Amazon EC2 Auto Scaling User Guide .

If you specify this property, you must specify at least one subnet for VPCZoneIdentifier when you create your group.



97
98
99
# File 'autoscaling/cfn_launch_configuration_props.rb', line 97

def associate_public_ip_address
  @associate_public_ip_address
end

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

The block device mapping entries that define the block devices to attach to the instances at launch.

By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide .



104
105
106
# File 'autoscaling/cfn_launch_configuration_props.rb', line 104

def block_device_mappings
  @block_device_mappings
end

Available for backward compatibility.



109
110
111
# File 'autoscaling/cfn_launch_configuration_props.rb', line 109

def classic_link_vpc_id
  @classic_link_vpc_id
end

Available for backward compatibility.



114
115
116
# File 'autoscaling/cfn_launch_configuration_props.rb', line 114

def classic_link_vpc_security_groups
  @classic_link_vpc_security_groups
end

#ebs_optimizedBoolean, ... (readonly)

Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).

The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide .

The default value is false .



123
124
125
# File 'autoscaling/cfn_launch_configuration_props.rb', line 123

def ebs_optimized
  @ebs_optimized
end

#iam_instance_profileString, ... (readonly)

The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.

The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide .



130
131
132
# File 'autoscaling/cfn_launch_configuration_props.rb', line 130

def iam_instance_profile
  @iam_instance_profile
end

#image_idString (readonly)

The ID of the Amazon Machine Image (AMI) that was assigned during registration.

For more information, see Find a Linux AMI in the Amazon EC2 User Guide .

If you specify InstanceId , an ImageId is not required.



77
78
79
# File 'autoscaling/cfn_launch_configuration_props.rb', line 77

def image_id
  @image_id
end

#instance_idString? (readonly)

The ID of the Amazon EC2 instance to use to create the launch configuration.

When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of BlockDeviceMapping and AssociatePublicIpAddress . You can override any properties from the instance by specifying them in the launch configuration.



137
138
139
# File 'autoscaling/cfn_launch_configuration_props.rb', line 137

def instance_id
  @instance_id
end

#instance_monitoringBoolean, ... (readonly)

Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.

The default value is true (enabled).

When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure monitoring for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide .



146
147
148
# File 'autoscaling/cfn_launch_configuration_props.rb', line 146

def instance_monitoring
  @instance_monitoring
end

#instance_typeString (readonly)

Specifies the instance type of the EC2 instance.

For information about available instance types, see Available instance types in the Amazon EC2 User Guide .

If you specify InstanceId , an InstanceType is not required.



86
87
88
# File 'autoscaling/cfn_launch_configuration_props.rb', line 86

def instance_type
  @instance_type
end

#kernel_idString? (readonly)

The ID of the kernel associated with the AMI.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide .



153
154
155
# File 'autoscaling/cfn_launch_configuration_props.rb', line 153

def kernel_id
  @kernel_id
end

#key_nameString? (readonly)

The name of the key pair.

For more information, see Amazon EC2 key pairs and Amazon EC2 instances in the Amazon EC2 User Guide .



160
161
162
# File 'autoscaling/cfn_launch_configuration_props.rb', line 160

def key_name
  @key_name
end

#launch_configuration_nameString? (readonly)

The name of the launch configuration.

This name must be unique per Region per account.



167
168
169
# File 'autoscaling/cfn_launch_configuration_props.rb', line 167

def launch_configuration_name
  @launch_configuration_name
end

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

The metadata options for the instances.

For more information, see Configure the instance metadata options in the Amazon EC2 Auto Scaling User Guide .



174
175
176
# File 'autoscaling/cfn_launch_configuration_props.rb', line 174

def 
  @metadata_options
end

#placement_tenancyString? (readonly)

The tenancy of the instance, either default or dedicated .

An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default ), you must set the value of this property to dedicated .

If you specify PlacementTenancy , you must specify at least one subnet for VPCZoneIdentifier when you create your group.

Valid values: default | dedicated



185
186
187
# File 'autoscaling/cfn_launch_configuration_props.rb', line 185

def placement_tenancy
  @placement_tenancy
end

#ram_disk_idString? (readonly)

The ID of the RAM disk to select.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide .



192
193
194
# File 'autoscaling/cfn_launch_configuration_props.rb', line 192

def ram_disk_id
  @ram_disk_id
end

#security_groupsArray<String, AWSCDK::Interfaces::AWSEC2::ISecurityGroupRef>? (readonly)

A list that contains the security groups to assign to the instances in the Auto Scaling group.

The list can contain both the IDs of existing security groups and references to SecurityGroup resources created in the template.

For more information, see Control traffic to resources using security groups in the Amazon Virtual Private Cloud User Guide .



201
202
203
# File 'autoscaling/cfn_launch_configuration_props.rb', line 201

def security_groups
  @security_groups
end

#spot_priceString? (readonly)

The maximum hourly price to be paid for any Spot Instance launched to fulfill the request.

Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Request Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide .

Valid Range: Minimum value of 0.001

When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.



212
213
214
# File 'autoscaling/cfn_launch_configuration_props.rb', line 212

def spot_price
  @spot_price
end

#user_dataString? (readonly)

The Base64-encoded user data to make available to the launched EC2 instances.

For more information, see Instance metadata and user data in the Amazon EC2 User Guide for Linux Instances .



219
220
221
# File 'autoscaling/cfn_launch_configuration_props.rb', line 219

def user_data
  @user_data
end

Class Method Details

.jsii_propertiesObject



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'autoscaling/cfn_launch_configuration_props.rb', line 221

def self.jsii_properties
  {
    :image_id => "imageId",
    :instance_type => "instanceType",
    :associate_public_ip_address => "associatePublicIpAddress",
    :block_device_mappings => "blockDeviceMappings",
    :classic_link_vpc_id => "classicLinkVpcId",
    :classic_link_vpc_security_groups => "classicLinkVpcSecurityGroups",
    :ebs_optimized => "ebsOptimized",
    :iam_instance_profile => "iamInstanceProfile",
    :instance_id => "instanceId",
    :instance_monitoring => "instanceMonitoring",
    :kernel_id => "kernelId",
    :key_name => "keyName",
    :launch_configuration_name => "launchConfigurationName",
    :metadata_options => "metadataOptions",
    :placement_tenancy => "placementTenancy",
    :ram_disk_id => "ramDiskId",
    :security_groups => "securityGroups",
    :spot_price => "spotPrice",
    :user_data => "userData",
  }
end

Instance Method Details

#to_jsiiObject



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'autoscaling/cfn_launch_configuration_props.rb', line 245

def to_jsii
  result = {}
  result.merge!({
    "imageId" => @image_id,
    "instanceType" => @instance_type,
    "associatePublicIpAddress" => @associate_public_ip_address,
    "blockDeviceMappings" => @block_device_mappings,
    "classicLinkVpcId" => @classic_link_vpc_id,
    "classicLinkVpcSecurityGroups" => @classic_link_vpc_security_groups,
    "ebsOptimized" => @ebs_optimized,
    "iamInstanceProfile" => @iam_instance_profile,
    "instanceId" => @instance_id,
    "instanceMonitoring" => @instance_monitoring,
    "kernelId" => @kernel_id,
    "keyName" => @key_name,
    "launchConfigurationName" => @launch_configuration_name,
    "metadataOptions" => @metadata_options,
    "placementTenancy" => @placement_tenancy,
    "ramDiskId" => @ram_disk_id,
    "securityGroups" => @security_groups,
    "spotPrice" => @spot_price,
    "userData" => @user_data,
  })
  result.compact
end