AwsLaunchTemplate

Creates an opinionated AWS EC2 launch template with safe defaults and ECS latest-image selection.

Remarks

Naming:

  • Root type ${namespace}:aws:AwsLaunchTemplate has capability launch-template, raw identity args.name, and target ${env}-${projectHash}-launch-template-${sanitiseNamePart(args.name)}. The identity is shared with the AWS name purpose.
  • aws:ec2/launchTemplate:LaunchTemplate has parent AwsLaunchTemplate, tuple [args.name], and target ${env}-${projectHash}-${sanitiseNamePart(args.name)}.
  • Provider name uses stackAndPurpose through buildAwsNameFromCamelCasePurpose, with raw args.name, maxLength: 115, and target ${env}-${projectHash}-${purpose}.
  • imageId.kind: 'direct' is a semantic/external identifier; its AMI ID is resolved through the EC2 AMI data source to obtain the EBS root-device name. imageId.kind: 'ecsLatest' and 'ecsGpuLatest' resolve the current AWS-managed ECS AMI through SSM before the same root-device lookup; the standard AWS naming pattern does not apply.

Example

CODE
const workers = new AwsLaunchTemplate({
  name: 'ecsWorkers',
  imageId: { kind: 'ecsLatest' },
  instanceType: 'm7g.large',
});

Constructors

new AwsLaunchTemplate( args: AwsLaunchTemplateArgs, options?: ComponentResourceOptions, ): AwsLaunchTemplate

Parameters

  • args (AwsLaunchTemplateArgs) — Template configuration, including the required logical identity and image source.
  • options (ComponentResourceOptions, optional) — Optional Pulumi component resource options, including provider selection.

Returns

AwsLaunchTemplate

Hierarchy

  • ComponentResource
  • AwsLaunchTemplate

Properties

latestVersion: OutputInstance<number>

readonly

Latest EC2 launch-template version.

launchTemplate: LaunchTemplate

readonly

Created EC2 launch template.

launchTemplateArn: Output<string>

readonly

EC2 launch-template ARN.

launchTemplateId: Output<string>

readonly

EC2 launch-template ID.

launchTemplateName: Output<string>

readonly

Resolved EC2 launch-template name.

urn: Output<string>

readonly

Inherited from urn

The stable logical URN used to distinctly address a resource, both before and after deployments.

Methods

getData(): Promise<any>

protectedasync

Inherited from getData

Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.

Returns

  • Promise<any>

getProvider(moduleMember: string): ProviderResource | undefined

Inherited from getProvider

Returns the provider for the given module member, if one exists.

Parameters

  • moduleMember (string)

Returns

  • ProviderResource | undefined

initialize( args: Inputs, opts?: ComponentResourceOptions, name?: string, type?: string, ): Promise<any>

protectedasync

Inherited from initialize

Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.

Parameters

  • args (Inputs)
  • opts (ComponentResourceOptions, optional)
  • name (string, optional)
  • type (string, optional)

Returns

  • Promise<any>

registerOutputs( outputs?: Inputs | Promise<Inputs> | Output<Inputs>, ): void

protected

Inherited from registerOutputs

Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

Parameters

  • outputs (Inputs | Promise<Inputs> | Output<Inputs>, optional)

Returns

  • void

Static Methods

isInstance(obj: any): obj is ComponentResource<any>

static

Inherited from isInstance

Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

Parameters

  • obj (any)

Returns

  • obj is ComponentResource<any>