Class LaunchTemplate
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.ec2.LaunchTemplate
- All Implemented Interfaces:
IConstruct,IDependable,IResource,IConnectable,ILaunchTemplate,IGrantable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:39.438Z")
@Stability(Stable)
public class LaunchTemplate
extends Resource
implements ILaunchTemplate, IGrantable, IConnectable
This represents an EC2 LaunchTemplate.
Example:
UserData bootHookConf = UserData.forLinux();
bootHookConf.addCommands("cloud-init-per once docker_options echo 'OPTIONS=\"${OPTIONS} --storage-opt dm.basesize=40G\"' >> /etc/sysconfig/docker");
UserData setupCommands = UserData.forLinux();
setupCommands.addCommands("sudo yum install awscli && echo Packages installed らと > /var/tmp/setup");
MultipartUserData multipartUserData = new MultipartUserData();
// The docker has to be configured at early stage, so content type is overridden to boothook
multipartUserData.addPart(MultipartBody.fromUserData(bootHookConf, "text/cloud-boothook; charset=\"us-ascii\""));
// Execute the rest of setup
multipartUserData.addPart(MultipartBody.fromUserData(setupCommands));
LaunchTemplate.Builder.create(this, "")
.userData(multipartUserData)
.blockDevices(List.of())
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IConnectable
IConnectable.Jsii$Default, IConnectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IGrantable
IGrantable.Jsii$Default, IGrantable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.ILaunchTemplate
ILaunchTemplate.Jsii$Default, ILaunchTemplate.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLaunchTemplate(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedLaunchTemplate(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 TypeMethodDescriptionstatic ILaunchTemplatefromLaunchTemplateAttributes(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 TagManagergetTags()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.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourceMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.constructs.Construct
toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.core.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStackMethods 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.
-
getConnections
Allows specifying security group connections for the instance.- Specified by:
getConnectionsin interfaceIConnectable
-
getDefaultVersionNumber
The default version for the launch template. -
getGrantPrincipal
Principal to grant permissions to.- Specified by:
getGrantPrincipalin 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:
getVersionNumberin 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
launchTemplateIdandlaunchTemplateNamewill be set.- Specified by:
getLaunchTemplateIdin interfaceILaunchTemplate
-
getLaunchTemplateName
The name of the Launch Template.Exactly one of
launchTemplateIdandlaunchTemplateNamewill be set.- Specified by:
getLaunchTemplateNamein 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.
-