Class CfnLaunchConfiguration

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.autoscaling.CfnLaunchConfiguration
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-12T19:33:57.881Z") @Stability(Stable) public class CfnLaunchConfiguration extends CfnResource implements IInspectable
The AWS::AutoScaling::LaunchConfiguration resource specifies the launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances.

When you update the launch configuration for an Auto Scaling group, CloudFormation deletes that resource and creates a new launch configuration with the updated properties and a new name. Existing instances are not affected. To update existing instances when you update the AWS::AutoScaling::LaunchConfiguration resource, you can specify an UpdatePolicy attribute for the group. You can find sample update policies for rolling updates in Configure Amazon EC2 Auto Scaling resources .

Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch template or a launch configuration. We strongly recommend that you do not use launch configurations. For more information, see Launch configurations in the Amazon EC2 Auto Scaling User Guide .

For help migrating from launch configurations to launch templates, see Migrate AWS CloudFormation stacks from launch configurations to launch templates in the Amazon EC2 Auto Scaling User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.autoscaling.*;
 CfnLaunchConfiguration cfnLaunchConfiguration = CfnLaunchConfiguration.Builder.create(this, "MyCfnLaunchConfiguration")
         .imageId("imageId")
         .instanceType("instanceType")
         // the properties below are optional
         .associatePublicIpAddress(false)
         .blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder()
                 .deviceName("deviceName")
                 // the properties below are optional
                 .ebs(BlockDeviceProperty.builder()
                         .deleteOnTermination(false)
                         .encrypted(false)
                         .iops(123)
                         .snapshotId("snapshotId")
                         .throughput(123)
                         .volumeSize(123)
                         .volumeType("volumeType")
                         .build())
                 .noDevice(false)
                 .virtualName("virtualName")
                 .build()))
         .classicLinkVpcId("classicLinkVpcId")
         .classicLinkVpcSecurityGroups(List.of("classicLinkVpcSecurityGroups"))
         .ebsOptimized(false)
         .iamInstanceProfile("iamInstanceProfile")
         .instanceId("instanceId")
         .instanceMonitoring(false)
         .kernelId("kernelId")
         .keyName("keyName")
         .launchConfigurationName("launchConfigurationName")
         .metadataOptions(MetadataOptionsProperty.builder()
                 .httpEndpoint("httpEndpoint")
                 .httpPutResponseHopLimit(123)
                 .httpTokens("httpTokens")
                 .build())
         .placementTenancy("placementTenancy")
         .ramDiskId("ramDiskId")
         .securityGroups(List.of("securityGroups"))
         .spotPrice("spotPrice")
         .userData("userData")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnLaunchConfiguration

      protected CfnLaunchConfiguration(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnLaunchConfiguration

      protected CfnLaunchConfiguration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnLaunchConfiguration

      @Stability(Stable) public CfnLaunchConfiguration(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnLaunchConfigurationProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getImageId

      @Stability(Stable) @NotNull public String getImageId()
      The ID of the Amazon Machine Image (AMI) that was assigned during registration.
    • setImageId

      @Stability(Stable) public void setImageId(@NotNull String value)
      The ID of the Amazon Machine Image (AMI) that was assigned during registration.
    • getInstanceType

      @Stability(Stable) @NotNull public String getInstanceType()
      Specifies the instance type of the EC2 instance.
    • setInstanceType

      @Stability(Stable) public void setInstanceType(@NotNull String value)
      Specifies the instance type of the EC2 instance.
    • getAssociatePublicIpAddress

      @Stability(Stable) @Nullable public Object getAssociatePublicIpAddress()
      Specifies whether to assign a public IPv4 address to the group's instances.
    • setAssociatePublicIpAddress

      @Stability(Stable) public void setAssociatePublicIpAddress(@Nullable Boolean value)
      Specifies whether to assign a public IPv4 address to the group's instances.
    • setAssociatePublicIpAddress

      @Stability(Stable) public void setAssociatePublicIpAddress(@Nullable IResolvable value)
      Specifies whether to assign a public IPv4 address to the group's instances.
    • getBlockDeviceMappings

      @Stability(Stable) @Nullable public Object getBlockDeviceMappings()
      The block device mapping entries that define the block devices to attach to the instances at launch.
    • setBlockDeviceMappings

      @Stability(Stable) public void setBlockDeviceMappings(@Nullable IResolvable value)
      The block device mapping entries that define the block devices to attach to the instances at launch.
    • setBlockDeviceMappings

      @Stability(Stable) public void setBlockDeviceMappings(@Nullable List<Object> value)
      The block device mapping entries that define the block devices to attach to the instances at launch.
    • getClassicLinkVpcId

      @Stability(Stable) @Nullable public String getClassicLinkVpcId()
      Available for backward compatibility.
    • setClassicLinkVpcId

      @Stability(Stable) public void setClassicLinkVpcId(@Nullable String value)
      Available for backward compatibility.
    • getClassicLinkVpcSecurityGroups

      @Stability(Stable) @Nullable public List<String> getClassicLinkVpcSecurityGroups()
      Available for backward compatibility.
    • setClassicLinkVpcSecurityGroups

      @Stability(Stable) public void setClassicLinkVpcSecurityGroups(@Nullable List<String> value)
      Available for backward compatibility.
    • getEbsOptimized

      @Stability(Stable) @Nullable public Object getEbsOptimized()
      Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).
    • setEbsOptimized

      @Stability(Stable) public void setEbsOptimized(@Nullable Boolean value)
      Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).
    • setEbsOptimized

      @Stability(Stable) public void setEbsOptimized(@Nullable IResolvable value)
      Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).
    • getIamInstanceProfile

      @Stability(Stable) @Nullable public String getIamInstanceProfile()
      The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.
    • setIamInstanceProfile

      @Stability(Stable) public void setIamInstanceProfile(@Nullable String value)
      The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.
    • getInstanceId

      @Stability(Stable) @Nullable public String getInstanceId()
      The ID of the Amazon EC2 instance to use to create the launch configuration.
    • setInstanceId

      @Stability(Stable) public void setInstanceId(@Nullable String value)
      The ID of the Amazon EC2 instance to use to create the launch configuration.
    • getInstanceMonitoring

      @Stability(Stable) @Nullable public Object getInstanceMonitoring()
      Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.
    • setInstanceMonitoring

      @Stability(Stable) public void setInstanceMonitoring(@Nullable Boolean value)
      Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.
    • setInstanceMonitoring

      @Stability(Stable) public void setInstanceMonitoring(@Nullable IResolvable value)
      Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.
    • getKernelId

      @Stability(Stable) @Nullable public String getKernelId()
      The ID of the kernel associated with the AMI.
    • setKernelId

      @Stability(Stable) public void setKernelId(@Nullable String value)
      The ID of the kernel associated with the AMI.
    • getKeyName

      @Stability(Stable) @Nullable public String getKeyName()
      The name of the key pair.
    • setKeyName

      @Stability(Stable) public void setKeyName(@Nullable String value)
      The name of the key pair.
    • getLaunchConfigurationName

      @Stability(Stable) @Nullable public String getLaunchConfigurationName()
      The name of the launch configuration.
    • setLaunchConfigurationName

      @Stability(Stable) public void setLaunchConfigurationName(@Nullable String value)
      The name of the launch configuration.
    • getMetadataOptions

      @Stability(Stable) @Nullable public Object getMetadataOptions()
      The metadata options for the instances.
    • setMetadataOptions

      @Stability(Stable) public void setMetadataOptions(@Nullable IResolvable value)
      The metadata options for the instances.
    • setMetadataOptions

      @Stability(Stable) public void setMetadataOptions(@Nullable CfnLaunchConfiguration.MetadataOptionsProperty value)
      The metadata options for the instances.
    • getPlacementTenancy

      @Stability(Stable) @Nullable public String getPlacementTenancy()
      The tenancy of the instance, either default or dedicated .
    • setPlacementTenancy

      @Stability(Stable) public void setPlacementTenancy(@Nullable String value)
      The tenancy of the instance, either default or dedicated .
    • getRamDiskId

      @Stability(Stable) @Nullable public String getRamDiskId()
      The ID of the RAM disk to select.
    • setRamDiskId

      @Stability(Stable) public void setRamDiskId(@Nullable String value)
      The ID of the RAM disk to select.
    • getSecurityGroups

      @Stability(Stable) @Nullable public List<String> getSecurityGroups()
      A list that contains the security groups to assign to the instances in the Auto Scaling group.
    • setSecurityGroups

      @Stability(Stable) public void setSecurityGroups(@Nullable List<String> value)
      A list that contains the security groups to assign to the instances in the Auto Scaling group.
    • getSpotPrice

      @Stability(Stable) @Nullable public String getSpotPrice()
      The maximum hourly price to be paid for any Spot Instance launched to fulfill the request.
    • setSpotPrice

      @Stability(Stable) public void setSpotPrice(@Nullable String value)
      The maximum hourly price to be paid for any Spot Instance launched to fulfill the request.
    • getUserData

      @Stability(Stable) @Nullable public String getUserData()
      The Base64-encoded user data to make available to the launched EC2 instances.
    • setUserData

      @Stability(Stable) public void setUserData(@Nullable String value)
      The Base64-encoded user data to make available to the launched EC2 instances.