Class CfnLaunchTemplate

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-04-10T22:22:26.609Z") @Stability(Stable) public class CfnLaunchTemplate extends CfnResource implements IInspectable
Specifies the properties for creating a launch template.

The minimum required properties for specifying a launch template are as follows:

  • You must specify at least one property for the launch template data.
  • You do not need to specify a name for the launch template. If you do not specify a name, AWS CloudFormation creates the name for you.

A launch template can contain some or all of the configuration information to launch an instance. When you launch an instance using a launch template, instance properties that are not specified in the launch template use default values, except the ImageId property, which has no default value. If you do not specify an AMI ID for the launch template ImageId property, you must specify an AMI ID for the instance ImageId property.

For more information, see Launch an instance from a launch template in the Amazon EC2 User Guide .

Example:

 Cluster cluster;
 String userData = "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"==MYBOUNDARY==\"\n\n--==MYBOUNDARY==\nContent-Type: text/x-shellscript; charset=\"us-ascii\"\n\n#!/bin/bash\necho \"Running custom user data script\"\n\n--==MYBOUNDARY==--\\\n";
 CfnLaunchTemplate lt = CfnLaunchTemplate.Builder.create(this, "LaunchTemplate")
         .launchTemplateData(LaunchTemplateDataProperty.builder()
                 .instanceType("t3.small")
                 .userData(Fn.base64(userData))
                 .build())
         .build();
 cluster.addNodegroupCapacity("extra-ng", NodegroupOptions.builder()
         .launchTemplateSpec(LaunchTemplateSpec.builder()
                 .id(lt.getRef())
                 .version(lt.getAttrLatestVersionNumber())
                 .build())
         .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

    • CfnLaunchTemplate

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

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

      @Stability(Stable) public CfnLaunchTemplate(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnLaunchTemplateProps 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.
    • getAttrDefaultVersionNumber

      @Stability(Stable) @NotNull public String getAttrDefaultVersionNumber()
      The default version of the launch template, such as 2.

      The default version of a launch template cannot be specified in AWS CloudFormation . The default version can be set in the Amazon EC2 console or by using the modify-launch-template AWS CLI command.

    • getAttrLatestVersionNumber

      @Stability(Stable) @NotNull public String getAttrLatestVersionNumber()
      The latest version of the launch template, such as 5 .
    • getAttrLaunchTemplateId

      @Stability(Stable) @NotNull public String getAttrLaunchTemplateId()
      The ID of the launch template.
    • getCfnProperties

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

      @Stability(Stable) @NotNull public Object getLaunchTemplateData()
      The information for the launch template.
    • setLaunchTemplateData

      @Stability(Stable) public void setLaunchTemplateData(@NotNull IResolvable value)
      The information for the launch template.
    • setLaunchTemplateData

      @Stability(Stable) public void setLaunchTemplateData(@NotNull CfnLaunchTemplate.LaunchTemplateDataProperty value)
      The information for the launch template.
    • getLaunchTemplateName

      @Stability(Stable) @Nullable public String getLaunchTemplateName()
      A name for the launch template.
    • setLaunchTemplateName

      @Stability(Stable) public void setLaunchTemplateName(@Nullable String value)
      A name for the launch template.
    • getTagSpecifications

      @Stability(Stable) @Nullable public Object getTagSpecifications()
      The tags to apply to the launch template on creation.
    • setTagSpecifications

      @Stability(Stable) public void setTagSpecifications(@Nullable IResolvable value)
      The tags to apply to the launch template on creation.
    • setTagSpecifications

      @Stability(Stable) public void setTagSpecifications(@Nullable List<Object> value)
      The tags to apply to the launch template on creation.
    • getVersionDescription

      @Stability(Stable) @Nullable public String getVersionDescription()
      A description for the first version of the launch template.
    • setVersionDescription

      @Stability(Stable) public void setVersionDescription(@Nullable String value)
      A description for the first version of the launch template.