LaunchTemplateArgs

data class LaunchTemplateArgs(val blockDeviceMappings: Output<List<LaunchTemplateBlockDeviceMappingArgs>>? = null, val capacityReservationSpecification: Output<LaunchTemplateCapacityReservationSpecificationArgs>? = null, val cpuOptions: Output<LaunchTemplateCpuOptionsArgs>? = null, val creditSpecification: Output<LaunchTemplateCreditSpecificationArgs>? = null, val defaultVersion: Output<Int>? = null, val description: Output<String>? = null, val disableApiStop: Output<Boolean>? = null, val disableApiTermination: Output<Boolean>? = null, val ebsOptimized: Output<String>? = null, val elasticGpuSpecifications: Output<List<LaunchTemplateElasticGpuSpecificationArgs>>? = null, val elasticInferenceAccelerator: Output<LaunchTemplateElasticInferenceAcceleratorArgs>? = null, val enclaveOptions: Output<LaunchTemplateEnclaveOptionsArgs>? = null, val hibernationOptions: Output<LaunchTemplateHibernationOptionsArgs>? = null, val iamInstanceProfile: Output<LaunchTemplateIamInstanceProfileArgs>? = null, val imageId: Output<String>? = null, val instanceInitiatedShutdownBehavior: Output<String>? = null, val instanceMarketOptions: Output<LaunchTemplateInstanceMarketOptionsArgs>? = null, val instanceRequirements: Output<LaunchTemplateInstanceRequirementsArgs>? = null, val instanceType: Output<String>? = null, val kernelId: Output<String>? = null, val keyName: Output<String>? = null, val licenseSpecifications: Output<List<LaunchTemplateLicenseSpecificationArgs>>? = null, val maintenanceOptions: Output<LaunchTemplateMaintenanceOptionsArgs>? = null, val metadataOptions: Output<LaunchTemplateMetadataOptionsArgs>? = null, val monitoring: Output<LaunchTemplateMonitoringArgs>? = null, val name: Output<String>? = null, val namePrefix: Output<String>? = null, val networkInterfaces: Output<List<LaunchTemplateNetworkInterfaceArgs>>? = null, val placement: Output<LaunchTemplatePlacementArgs>? = null, val privateDnsNameOptions: Output<LaunchTemplatePrivateDnsNameOptionsArgs>? = null, val ramDiskId: Output<String>? = null, val securityGroupNames: Output<List<String>>? = null, val tagSpecifications: Output<List<LaunchTemplateTagSpecificationArgs>>? = null, val tags: Output<Map<String, String>>? = null, val updateDefaultVersion: Output<Boolean>? = null, val userData: Output<String>? = null, val vpcSecurityGroupIds: Output<List<String>>? = null) : ConvertibleToJava<LaunchTemplateArgs>

Provides an EC2 launch template resource. Can be used to create instances or auto scaling groups.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.LaunchTemplate;
import com.pulumi.aws.ec2.LaunchTemplateArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateBlockDeviceMappingArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateBlockDeviceMappingEbsArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateCapacityReservationSpecificationArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateCpuOptionsArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateCreditSpecificationArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateElasticGpuSpecificationArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateElasticInferenceAcceleratorArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateIamInstanceProfileArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateInstanceMarketOptionsArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateLicenseSpecificationArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateMetadataOptionsArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateMonitoringArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateNetworkInterfaceArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplatePlacementArgs;
import com.pulumi.aws.ec2.inputs.LaunchTemplateTagSpecificationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var foo = new LaunchTemplate("foo", LaunchTemplateArgs.builder()
.blockDeviceMappings(LaunchTemplateBlockDeviceMappingArgs.builder()
.deviceName("/dev/sdf")
.ebs(LaunchTemplateBlockDeviceMappingEbsArgs.builder()
.volumeSize(20)
.build())
.build())
.capacityReservationSpecification(LaunchTemplateCapacityReservationSpecificationArgs.builder()
.capacityReservationPreference("open")
.build())
.cpuOptions(LaunchTemplateCpuOptionsArgs.builder()
.coreCount(4)
.threadsPerCore(2)
.build())
.creditSpecification(LaunchTemplateCreditSpecificationArgs.builder()
.cpuCredits("standard")
.build())
.disableApiStop(true)
.disableApiTermination(true)
.ebsOptimized(true)
.elasticGpuSpecifications(LaunchTemplateElasticGpuSpecificationArgs.builder()
.type("test")
.build())
.elasticInferenceAccelerator(LaunchTemplateElasticInferenceAcceleratorArgs.builder()
.type("eia1.medium")
.build())
.iamInstanceProfile(LaunchTemplateIamInstanceProfileArgs.builder()
.name("test")
.build())
.imageId("ami-test")
.instanceInitiatedShutdownBehavior("terminate")
.instanceMarketOptions(LaunchTemplateInstanceMarketOptionsArgs.builder()
.marketType("spot")
.build())
.instanceType("t2.micro")
.kernelId("test")
.keyName("test")
.licenseSpecifications(LaunchTemplateLicenseSpecificationArgs.builder()
.licenseConfigurationArn("arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef")
.build())
.metadataOptions(LaunchTemplateMetadataOptionsArgs.builder()
.httpEndpoint("enabled")
.httpTokens("required")
.httpPutResponseHopLimit(1)
.instanceMetadataTags("enabled")
.build())
.monitoring(LaunchTemplateMonitoringArgs.builder()
.enabled(true)
.build())
.networkInterfaces(LaunchTemplateNetworkInterfaceArgs.builder()
.associatePublicIpAddress(true)
.build())
.placement(LaunchTemplatePlacementArgs.builder()
.availabilityZone("us-west-2a")
.build())
.ramDiskId("test")
.vpcSecurityGroupIds("sg-12345678")
.tagSpecifications(LaunchTemplateTagSpecificationArgs.builder()
.resourceType("instance")
.tags(Map.of("Name", "test"))
.build())
.userData(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get(String.format("%s/example.sh", path.module())))))
.build());
}
}

Import

Launch Templates can be imported using the id, e.g.,

$ pulumi import aws:ec2/launchTemplate:LaunchTemplate web lt-12345678

Constructors

Link copied to clipboard
constructor(blockDeviceMappings: Output<List<LaunchTemplateBlockDeviceMappingArgs>>? = null, capacityReservationSpecification: Output<LaunchTemplateCapacityReservationSpecificationArgs>? = null, cpuOptions: Output<LaunchTemplateCpuOptionsArgs>? = null, creditSpecification: Output<LaunchTemplateCreditSpecificationArgs>? = null, defaultVersion: Output<Int>? = null, description: Output<String>? = null, disableApiStop: Output<Boolean>? = null, disableApiTermination: Output<Boolean>? = null, ebsOptimized: Output<String>? = null, elasticGpuSpecifications: Output<List<LaunchTemplateElasticGpuSpecificationArgs>>? = null, elasticInferenceAccelerator: Output<LaunchTemplateElasticInferenceAcceleratorArgs>? = null, enclaveOptions: Output<LaunchTemplateEnclaveOptionsArgs>? = null, hibernationOptions: Output<LaunchTemplateHibernationOptionsArgs>? = null, iamInstanceProfile: Output<LaunchTemplateIamInstanceProfileArgs>? = null, imageId: Output<String>? = null, instanceInitiatedShutdownBehavior: Output<String>? = null, instanceMarketOptions: Output<LaunchTemplateInstanceMarketOptionsArgs>? = null, instanceRequirements: Output<LaunchTemplateInstanceRequirementsArgs>? = null, instanceType: Output<String>? = null, kernelId: Output<String>? = null, keyName: Output<String>? = null, licenseSpecifications: Output<List<LaunchTemplateLicenseSpecificationArgs>>? = null, maintenanceOptions: Output<LaunchTemplateMaintenanceOptionsArgs>? = null, metadataOptions: Output<LaunchTemplateMetadataOptionsArgs>? = null, monitoring: Output<LaunchTemplateMonitoringArgs>? = null, name: Output<String>? = null, namePrefix: Output<String>? = null, networkInterfaces: Output<List<LaunchTemplateNetworkInterfaceArgs>>? = null, placement: Output<LaunchTemplatePlacementArgs>? = null, privateDnsNameOptions: Output<LaunchTemplatePrivateDnsNameOptionsArgs>? = null, ramDiskId: Output<String>? = null, securityGroupNames: Output<List<String>>? = null, tagSpecifications: Output<List<LaunchTemplateTagSpecificationArgs>>? = null, tags: Output<Map<String, String>>? = null, updateDefaultVersion: Output<Boolean>? = null, userData: Output<String>? = null, vpcSecurityGroupIds: Output<List<String>>? = null)

Properties

Link copied to clipboard

Specify volumes to attach to the instance besides the volumes specified by the AMI. See Block Devices below for details.

Link copied to clipboard

Targeting for EC2 capacity reservations. See Capacity Reservation Specification below for more details.

Link copied to clipboard

The CPU options for the instance. See CPU Options below for more details.

Link copied to clipboard

Customize the credit specification of the instance. See Credit Specification below for more details.

Link copied to clipboard
val defaultVersion: Output<Int>? = null

Default Version of the launch template.

Link copied to clipboard
val description: Output<String>? = null

Description of the launch template.

Link copied to clipboard
val disableApiStop: Output<Boolean>? = null
Link copied to clipboard
val disableApiTermination: Output<Boolean>? = null

If true, enables [EC2 Instance

Link copied to clipboard
val ebsOptimized: Output<String>? = null

If true, the launched EC2 instance will be EBS-optimized.

Link copied to clipboard

The elastic GPU to attach to the instance. See Elastic GPU below for more details.

Link copied to clipboard

Configuration block containing an Elastic Inference Accelerator to attach to the instance. See Elastic Inference Accelerator below for more details.

Link copied to clipboard

Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.

Link copied to clipboard

The hibernation options for the instance. See Hibernation Options below for more details.

Link copied to clipboard

The IAM Instance Profile to launch the instance with. See Instance Profile below for more details.

Link copied to clipboard
val imageId: Output<String>? = null

The AMI from which to launch the instance.

Link copied to clipboard

Shutdown behavior for the instance. Can be stop or terminate. (Default: stop).

Link copied to clipboard

The market (purchasing) option for the instance. See Market Options below for details.

Link copied to clipboard

The attribute requirements for the type of instance. If present then instance_type cannot be present.

Link copied to clipboard
val instanceType: Output<String>? = null

The type of the instance. If present then instance_requirements cannot be present.

Link copied to clipboard
val kernelId: Output<String>? = null

The kernel ID.

Link copied to clipboard
val keyName: Output<String>? = null

The key name to use for the instance.

Link copied to clipboard

A list of license specifications to associate with. See License Specification below for more details.

Link copied to clipboard

The maintenance options for the instance. See Maintenance Options below for more details.

Link copied to clipboard

Customize the metadata options for the instance. See Metadata Options below for more details.

Link copied to clipboard

The monitoring option for the instance. See Monitoring below for more details.

Link copied to clipboard
val name: Output<String>? = null

The name of the launch template. If you leave this blank, the provider will auto-generate a unique name.

Link copied to clipboard
val namePrefix: Output<String>? = null

Creates a unique name beginning with the specified prefix. Conflicts with name.

Link copied to clipboard

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

Link copied to clipboard

The placement of the instance. See Placement below for more details.

Link copied to clipboard

The options for the instance hostname. The default values are inherited from the subnet. See Private DNS Name Options below for more details.

Link copied to clipboard
val ramDiskId: Output<String>? = null

The ID of the RAM disk.

Link copied to clipboard
val securityGroupNames: Output<List<String>>? = null

A list of security group names to associate with. If you are creating Instances in a VPC, use vpc_security_group_ids instead.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to assign to the launch template. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard

The tags to apply to the resources during launch. See Tag Specifications below for more details.

Link copied to clipboard
val updateDefaultVersion: Output<Boolean>? = null

Whether to update Default Version each update. Conflicts with default_version.

Link copied to clipboard
val userData: Output<String>? = null

The base64-encoded user data to provide when launching the instance.

Link copied to clipboard
val vpcSecurityGroupIds: Output<List<String>>? = null

A list of security group IDs to associate with. Conflicts with network_interfaces.security_groups

Functions

Link copied to clipboard
open override fun toJava(): LaunchTemplateArgs