Launch Template Args
Provides an ECS Launch Template resource. For information about Launch Template and how to use it, see Launch Template.
DEPRECATED: This resource has been deprecated from version
1.120.0
. Please use new resource alicloud_ecs_launch_template.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
import com.pulumi.alicloud.ecs.LaunchTemplate;
import com.pulumi.alicloud.ecs.LaunchTemplateArgs;
import com.pulumi.alicloud.ecs.inputs.LaunchTemplateNetworkInterfacesArgs;
import com.pulumi.alicloud.ecs.inputs.LaunchTemplateDataDiskArgs;
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) {
final var images = EcsFunctions.getImages(GetImagesArgs.builder()
.owners("system")
.build());
final var instances = EcsFunctions.getInstances();
var template = new LaunchTemplate("template", LaunchTemplateArgs.builder()
.description("test1")
.imageId(images.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
.hostName("tf-test-host")
.instanceChargeType("PrePaid")
.instanceName("tf-instance-name")
.instanceType(instances.applyValue(getInstancesResult -> getInstancesResult.instances()[0].instanceType()))
.internetChargeType("PayByBandwidth")
.internetMaxBandwidthIn(5)
.internetMaxBandwidthOut(0)
.ioOptimized("none")
.keyPairName("test-key-pair")
.ramRoleName("xxxxx")
.networkType("vpc")
.securityEnhancementStrategy("Active")
.spotPriceLimit(5)
.spotStrategy("SpotWithPriceLimit")
.securityGroupId("sg-zxcvj0lasdf102350asdf9a")
.systemDiskCategory("cloud_ssd")
.systemDiskDescription("test disk")
.systemDiskName("hello")
.systemDiskSize(40)
.resourceGroupId("rg-zkdfjahg9zxncv0")
.userdata("xxxxxxxxxxxxxx")
.vswitchId("sw-ljkngaksdjfj0nnasdf")
.vpcId("vpc-asdfnbg0as8dfk1nb2")
.zoneId("beijing-a")
.tags(Map.ofEntries(
Map.entry("tag1", "hello"),
Map.entry("tag2", "world")
))
.networkInterfaces(LaunchTemplateNetworkInterfacesArgs.builder()
.name("eth0")
.description("hello1")
.primaryIp("10.0.0.2")
.securityGroupId("xxxx")
.vswitchId("xxxxxxx")
.build())
.dataDisks(
LaunchTemplateDataDiskArgs.builder()
.name("disk1")
.description("test1")
.build(),
LaunchTemplateDataDiskArgs.builder()
.name("disk2")
.description("test2")
.build())
.build());
}
}
Import
Launch Template can be imported using the id, e.g.
$ pulumi import alicloud:ecs/launchTemplate:LaunchTemplate lt lt-abc1234567890000
Constructors
Functions
Properties
Instance host name.It cannot start or end with a period (.) or a hyphen (-) and it cannot have two or more consecutive periods (.) or hyphens (-).For Windows: The host name can be 2, 15 characters in length. It can contain A-Z, a-z, numbers, periods (.), and hyphens (-). It cannot only contain numbers. For other operating systems: The host name can be 2, 64 characters in length. It can be segments separated by periods (.). It can contain A-Z, a-z, numbers, and hyphens (-).