Skip to content
v2.275.0

LaunchTemplateSpec Struct ​

Launch template property specification.

Example ​

ts
declare const cluster: eks.Cluster;

const userData = `MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"

#!/bin/bash
echo "Running custom user data script"

--==MYBOUNDARY==--\\
`;
const lt = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', {
  launchTemplateData: {
    instanceType: 't3.small',
    userData: Fn.base64(userData),
  },
});

cluster.addNodegroupCapacity('extra-ng', {
  launchTemplateSpec: {
    id: lt.ref,
    version: lt.attrLatestVersionNumber,
  },
});

Properties ​

idstringidstridStringIdstringId*stringrequired#
The Launch template ID.
versionoptionalstringversionoptionalstrversionoptionalStringVersionoptionalstringVersionoptional*string#
The launch template version to be used (optional).

Default: the default version of the launch template