Launch Template Args
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());
}
}
Content copied to clipboard
Import
Launch Templates can be imported using the id
, e.g.,
$ pulumi import aws:ec2/launchTemplate:LaunchTemplate web lt-12345678
Content copied to clipboard
Constructors
Link copied to clipboard
fun LaunchTemplateArgs(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)
Functions
Properties
Link copied to clipboard
val capacityReservationSpecification: Output<LaunchTemplateCapacityReservationSpecificationArgs>? = null
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard