EcsLaunchTemplate

class EcsLaunchTemplate : KotlinCustomResource

Provides a ECS Launch Template resource. For information about ECS Launch Template and how to use it, see What is Launch Template.

NOTE: Available since v1.120.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ecs.EcsLaunchTemplate;
import com.pulumi.alicloud.ecs.EcsLaunchTemplateArgs;
import com.pulumi.alicloud.ecs.inputs.EcsLaunchTemplateSystemDiskArgs;
import com.pulumi.alicloud.ecs.inputs.EcsLaunchTemplateNetworkInterfacesArgs;
import com.pulumi.alicloud.ecs.inputs.EcsLaunchTemplateDataDiskArgs;
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 defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableDiskCategory("cloud_efficiency")
.availableResourceCreation("VSwitch")
.build());
final var defaultInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
final var defaultImages = EcsFunctions.getImages(GetImagesArgs.builder()
.nameRegex("^ubuntu_[0-9]+_[0-9]+_x64*")
.owners("system")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName("terraform-example")
.cidrBlock("172.17.3.0/24")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName("terraform-example")
.cidrBlock("172.17.3.0/24")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultEcsLaunchTemplate = new EcsLaunchTemplate("defaultEcsLaunchTemplate", EcsLaunchTemplateArgs.builder()
.launchTemplateName("terraform-example")
.description("terraform-example")
.imageId(defaultImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
.hostName("terraform-example")
.instanceChargeType("PrePaid")
.instanceName("terraform-example")
.instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
.internetChargeType("PayByBandwidth")
.internetMaxBandwidthIn("5")
.internetMaxBandwidthOut("5")
.ioOptimized("optimized")
.keyPairName("key_pair_name")
.ramRoleName("ram_role_name")
.networkType("vpc")
.securityEnhancementStrategy("Active")
.spotPriceLimit("5")
.spotStrategy("SpotWithPriceLimit")
.securityGroupIds(defaultSecurityGroup.id())
.systemDisk(EcsLaunchTemplateSystemDiskArgs.builder()
.category("cloud_ssd")
.description("Test For Terraform")
.name("terraform-example")
.size("40")
.deleteWithInstance("false")
.build())
.userData("xxxxxxx")
.vswitchId(defaultSwitch.id())
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.templateTags(Map.ofEntries(
Map.entry("Create", "Terraform"),
Map.entry("For", "example")
))
.networkInterfaces(EcsLaunchTemplateNetworkInterfacesArgs.builder()
.name("eth0")
.description("hello1")
.primaryIp("10.0.0.2")
.securityGroupId(defaultSecurityGroup.id())
.vswitchId(defaultSwitch.id())
.build())
.dataDisks(
EcsLaunchTemplateDataDiskArgs.builder()
.name("disk1")
.description("description")
.deleteWithInstance("true")
.category("cloud")
.encrypted("false")
.performanceLevel("PL0")
.size("20")
.build(),
EcsLaunchTemplateDataDiskArgs.builder()
.name("disk2")
.description("description2")
.deleteWithInstance("true")
.category("cloud")
.encrypted("false")
.performanceLevel("PL0")
.size("20")
.build())
.build());
}
}

Import

ECS Launch Template can be imported using the id, e.g.

$ pulumi import alicloud:ecs/ecsLaunchTemplate:EcsLaunchTemplate example <id>

Properties

Link copied to clipboard
val autoReleaseTime: Output<String>?

Instance auto release time. The time is presented using the ISO8601 standard and in UTC time. The format is YYYY-MM-DDTHH:MM:SSZ.

Link copied to clipboard

The list of data disks created with instance. See data_disks below.

Link copied to clipboard
val deploymentSetId: Output<String>?

The Deployment Set Id.

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

Description of instance launch template version 1. It can be 2, 256 characters in length. It cannot start with "http://" or "https://". The default value is null.

Link copied to clipboard

Whether to enable the instance operating system configuration.

Link copied to clipboard
val hostName: Output<String>?

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 (-).

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

The Image ID.

Link copied to clipboard
val imageOwnerAlias: Output<String>?

Mirror source. Valid values: system, self, others, marketplace, "". Default to: "".

Link copied to clipboard

Billing methods. Valid values: PostPaid, PrePaid.

Link copied to clipboard
val instanceName: Output<String>?

The name of the instance. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

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

Instance type. For more information, call resource_alicloud_instances to obtain the latest instance type list.

Link copied to clipboard

Internet bandwidth billing method. Valid values: PayByTraffic, PayByBandwidth.

Link copied to clipboard

The maximum inbound bandwidth from the Internet network, measured in Mbit/s. Value range: 1, 200.

Link copied to clipboard

Maximum outbound bandwidth from the Internet, its unit of measurement is Mbit/s. Value range: 0, 100.

Link copied to clipboard
val ioOptimized: Output<String>?

Whether it is an I/O-optimized instance or not. Valid values: none, optimized.

Link copied to clipboard
val keyPairName: Output<String>?

The name of the key pair.

Link copied to clipboard

The name of Launch Template.

Link copied to clipboard
val name: Output<String>

It has been deprecated from version 1.120.0, and use field launch_template_name instead.

Link copied to clipboard

The list of network interfaces created with instance. See network_interfaces below.

Link copied to clipboard
val networkType: Output<String>?

Network type of the instance. Valid values: classic, vpc.

Link copied to clipboard
val passwordInherit: Output<Boolean>?

Whether to use the password preset by the mirror.

Link copied to clipboard
val period: Output<Int>?

The subscription period of the instance. Unit: months. This parameter takes effect and is required only when InstanceChargeType is set to PrePaid. If the DedicatedHostId parameter is specified, the value of the Period parameter must be within the subscription period of the dedicated host.

Link copied to clipboard
val privateIpAddress: Output<String>?

The private IP address of the instance.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ramRoleName: Output<String>?

The RAM role name of the instance. You can use the RAM API ListRoles to query instance RAM role names.

Link copied to clipboard
val resourceGroupId: Output<String>?

The ID of the resource group to which to assign the instance, Elastic Block Storage (EBS) device, and ENI.

Link copied to clipboard

Whether or not to activate the security enhancement feature and install network security software free of charge. Valid values: Active, Deactive.

Link copied to clipboard
val securityGroupId: Output<String>?

The security group ID.

Link copied to clipboard

The ID of security group N to which to assign the instance.

Link copied to clipboard
val spotDuration: Output<String>?

The protection period of the preemptible instance. Unit: hours. Valid values: 0, 1, 2, 3, 4, 5, and 6. Default to: 1.

Link copied to clipboard
val spotPriceLimit: Output<Double>?

Sets the maximum hourly instance price. Supports up to three decimal places.

Link copied to clipboard
val spotStrategy: Output<String>?

The spot strategy for a Pay-As-You-Go instance. This parameter is valid and required only when InstanceChargeType is set to PostPaid. Valid values: NoSpot, SpotAsPriceGo, SpotWithPriceLimit.

Link copied to clipboard

The System Disk. See system_disk below.

Link copied to clipboard

It has been deprecated from version 1.120.0, and use field system_disk instead.

Link copied to clipboard

It has been deprecated from version 1.120.0, and use field system_disk instead.

Link copied to clipboard
val systemDiskName: Output<String>

It has been deprecated from version 1.120.0, and use field system_disk instead.

Link copied to clipboard
val systemDiskSize: Output<Int>

It has been deprecated from version 1.120.0, and use field system_disk instead.

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

A mapping of tags to assign to instance, block storage, and elastic network.

Link copied to clipboard

The template resource group id.

Link copied to clipboard
val templateTags: Output<Map<String, Any>>?

A mapping of tags to assign to the launch template.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val userData: Output<String>

The User Data.

Link copied to clipboard
val userdata: Output<String>

It has been deprecated from version 1.120.0, and use field user_data instead.

Link copied to clipboard

The description of the launch template version. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

Link copied to clipboard
val vpcId: Output<String>

The ID of the VPC.

Link copied to clipboard
val vswitchId: Output<String>?

When creating a VPC-Connected instance, you must specify its VSwitch ID.

Link copied to clipboard
val zoneId: Output<String>

The zone ID of the instance.