Show / Hide Table of Contents

Class LaunchTemplate

This represents an EC2 LaunchTemplate.

Inheritance
System.Object
Construct
Resource
LaunchTemplate
Implements
ILaunchTemplate
IResource
IConstruct
Constructs.IConstruct
IDependable
IGrantable
IConnectable
Inherited Members
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(String, IArnComponents)
Resource.GetResourceNameAttribute(String)
Resource.Env
Resource.PhysicalName
Resource.Stack
Construct.IsConstruct(Object)
Construct.OnPrepare()
Construct.OnSynthesize(ISynthesisSession)
Construct.OnValidate()
Construct.Prepare()
Construct.Synthesize(ISynthesisSession)
Construct.Validate()
Construct.Node
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public class LaunchTemplate : Resource, ILaunchTemplate, IResource, IConstruct, IConstruct, IDependable, IGrantable, IConnectable
Syntax (vb)
Public Class LaunchTemplate
    Inherits Resource
    Implements ILaunchTemplate, IResource, IConstruct, IConstruct, IDependable, IGrantable, IConnectable
Remarks

See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html

ExampleMetadata: infused

Examples
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));

new LaunchTemplate(this, "", new LaunchTemplateProps {
    UserData = multipartUserData,
    BlockDevices = new [] {  }
});

Synopsis

Constructors

LaunchTemplate(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

LaunchTemplate(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

LaunchTemplate(Construct, String, ILaunchTemplateProps)

Properties

Connections

Allows specifying security group connections for the instance.

DefaultVersionNumber

The default version for the launch template.

GrantPrincipal

Principal to grant permissions to.

ImageId

The AMI ID of the image to use.

InstanceType

Type of instance to launch.

LatestVersionNumber

The latest version of the launch template.

LaunchTemplateId

The identifier of the Launch Template.

LaunchTemplateName

The name of the Launch Template.

OsType

The type of OS the instance is running.

Role

IAM Role assumed by instances that are launched from this template.

Tags

TagManager for tagging support.

UserData

UserData executed by instances that are launched from this template.

VersionNumber

The version number of this launch template to use.

Methods

FromLaunchTemplateAttributes(Construct, String, ILaunchTemplateAttributes)

Import an existing LaunchTemplate.

Constructors

LaunchTemplate(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

protected LaunchTemplate(ByRefValue reference)
Parameters
reference Amazon.JSII.Runtime.Deputy.ByRefValue

The Javascript-owned object reference

LaunchTemplate(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

protected LaunchTemplate(DeputyBase.DeputyProps props)
Parameters
props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps

The deputy props

LaunchTemplate(Construct, String, ILaunchTemplateProps)

public LaunchTemplate(Construct scope, string id, ILaunchTemplateProps props = null)
Parameters
scope Constructs.Construct
id System.String
props ILaunchTemplateProps

Properties

Connections

Allows specifying security group connections for the instance.

public virtual Connections_ Connections { get; }
Property Value

Connections_

Remarks

Note: Only available if you provide a securityGroup when constructing the LaunchTemplate.

DefaultVersionNumber

The default version for the launch template.

public virtual string DefaultVersionNumber { get; }
Property Value

System.String

Remarks

Attribute: true

GrantPrincipal

Principal to grant permissions to.

public virtual IPrincipal GrantPrincipal { get; }
Property Value

IPrincipal

Remarks

Note: Only available if you provide a role when constructing the LaunchTemplate.

ImageId

The AMI ID of the image to use.

public virtual string ImageId { get; }
Property Value

System.String

Remarks

Attribute: true

InstanceType

Type of instance to launch.

public virtual InstanceType InstanceType { get; }
Property Value

InstanceType

Remarks

Attribute: true

LatestVersionNumber

The latest version of the launch template.

public virtual string LatestVersionNumber { get; }
Property Value

System.String

Remarks

Attribute: true

LaunchTemplateId

The identifier of the Launch Template.

public virtual string LaunchTemplateId { get; }
Property Value

System.String

Remarks

Exactly one of launchTemplateId and launchTemplateName will be set.

LaunchTemplateName

The name of the Launch Template.

public virtual string LaunchTemplateName { get; }
Property Value

System.String

Remarks

Exactly one of launchTemplateId and launchTemplateName will be set.

OsType

The type of OS the instance is running.

public virtual Nullable<OperatingSystemType> OsType { get; }
Property Value

System.Nullable<OperatingSystemType>

Remarks

Attribute: true

Role

IAM Role assumed by instances that are launched from this template.

public virtual IRole Role { get; }
Property Value

IRole

Remarks

Attribute: true

Tags

TagManager for tagging support.

protected virtual TagManager Tags { get; }
Property Value

TagManager

UserData

UserData executed by instances that are launched from this template.

public virtual UserData UserData { get; }
Property Value

UserData

Remarks

Attribute: true

VersionNumber

The version number of this launch template to use.

public virtual string VersionNumber { get; }
Property Value

System.String

Methods

FromLaunchTemplateAttributes(Construct, String, ILaunchTemplateAttributes)

Import an existing LaunchTemplate.

public static ILaunchTemplate FromLaunchTemplateAttributes(Construct scope, string id, ILaunchTemplateAttributes attrs)
Parameters
scope Constructs.Construct
id System.String
attrs ILaunchTemplateAttributes
Returns

ILaunchTemplate

Implements

ILaunchTemplate
IResource
IConstruct
Constructs.IConstruct
IDependable
IGrantable
IConnectable
Back to top Generated by DocFX