Class LaunchTemplate
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.LaunchTemplate
- All Implemented Interfaces:
IResource
,IConnectable
,ILaunchTemplate
,IGrantable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.106.0 (build e852934)",
date="2025-02-12T12:32:01.819Z")
@Stability(Stable)
public class LaunchTemplate
extends Resource
implements ILaunchTemplate, IGrantable, IConnectable
This represents an EC2 LaunchTemplate.
Example:
Vpc vpc; SecurityGroup sg1 = SecurityGroup.Builder.create(this, "sg1") .vpc(vpc) .build(); SecurityGroup sg2 = SecurityGroup.Builder.create(this, "sg2") .vpc(vpc) .build(); LaunchTemplate launchTemplate = LaunchTemplate.Builder.create(this, "LaunchTemplate") .machineImage(MachineImage.latestAmazonLinux2023()) .securityGroup(sg1) .build(); launchTemplate.addSecurityGroup(sg2);
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IConnectable
IConnectable.Jsii$Default, IConnectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IGrantable
IGrantable.Jsii$Default, IGrantable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.ILaunchTemplate
ILaunchTemplate.Jsii$Default, ILaunchTemplate.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LaunchTemplate
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
LaunchTemplate
(software.amazon.jsii.JsiiObjectRef objRef) LaunchTemplate
(software.constructs.Construct scope, String id) LaunchTemplate
(software.constructs.Construct scope, String id, LaunchTemplateProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSecurityGroup
(ISecurityGroup securityGroup) Add the security group to the instance.static ILaunchTemplate
fromLaunchTemplateAttributes
(software.constructs.Construct scope, String id, LaunchTemplateAttributes attrs) Import an existing LaunchTemplate.Allows specifying security group connections for the instance.The default version for the launch template.Principal to grant permissions to.The AMI ID of the image to use.Type of instance to launch.The latest version of the launch template.The identifier of the Launch Template.The name of the Launch Template.The type of OS the instance is running.getRole()
IAM Role assumed by instances that are launched from this template.protected TagManager
getTags()
TagManager for tagging support.UserData executed by instances that are launched from this template.The version number of this launch template to use.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
LaunchTemplate
protected LaunchTemplate(software.amazon.jsii.JsiiObjectRef objRef) -
LaunchTemplate
protected LaunchTemplate(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
LaunchTemplate
@Stability(Stable) public LaunchTemplate(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable LaunchTemplateProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
-
-
LaunchTemplate
@Stability(Stable) public LaunchTemplate(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.
-
-
Method Details
-
fromLaunchTemplateAttributes
@Stability(Stable) @NotNull public static ILaunchTemplate fromLaunchTemplateAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull LaunchTemplateAttributes attrs) Import an existing LaunchTemplate.- Parameters:
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.
-
addSecurityGroup
Add the security group to the instance.- Parameters:
securityGroup
- : The security group to add. This parameter is required.
-
getConnections
Allows specifying security group connections for the instance.- Specified by:
getConnections
in interfaceIConnectable
-
getDefaultVersionNumber
The default version for the launch template. -
getGrantPrincipal
Principal to grant permissions to.- Specified by:
getGrantPrincipal
in interfaceIGrantable
-
getLatestVersionNumber
The latest version of the launch template. -
getTags
TagManager for tagging support. -
getVersionNumber
The version number of this launch template to use.- Specified by:
getVersionNumber
in interfaceILaunchTemplate
-
getImageId
The AMI ID of the image to use. -
getInstanceType
Type of instance to launch. -
getLaunchTemplateId
The identifier of the Launch Template.Exactly one of
launchTemplateId
andlaunchTemplateName
will be set.- Specified by:
getLaunchTemplateId
in interfaceILaunchTemplate
-
getLaunchTemplateName
The name of the Launch Template.Exactly one of
launchTemplateId
andlaunchTemplateName
will be set.- Specified by:
getLaunchTemplateName
in interfaceILaunchTemplate
-
getOsType
The type of OS the instance is running. -
getRole
IAM Role assumed by instances that are launched from this template. -
getUserData
UserData executed by instances that are launched from this template.
-