EcsInstanceSetArgs

data class EcsInstanceSetArgs(val amount: Output<Int>? = null, val autoReleaseTime: Output<String>? = null, val autoRenew: Output<Boolean>? = null, val autoRenewPeriod: Output<Int>? = null, val bootCheckOsWithAssistant: Output<Boolean>? = null, val dataDisks: Output<List<EcsInstanceSetDataDiskArgs>>? = null, val dedicatedHostId: Output<String>? = null, val deletionProtection: Output<Boolean>? = null, val deploymentSetId: Output<String>? = null, val description: Output<String>? = null, val excludeInstanceFilter: Output<EcsInstanceSetExcludeInstanceFilterArgs>? = null, val hostName: Output<String>? = null, val hpcClusterId: Output<String>? = null, val imageId: Output<String>? = null, val instanceChargeType: Output<String>? = null, val instanceName: Output<String>? = null, val instanceType: Output<String>? = null, val internetChargeType: Output<String>? = null, val internetMaxBandwidthOut: Output<Int>? = null, val keyPairName: Output<String>? = null, val launchTemplateId: Output<String>? = null, val launchTemplateName: Output<String>? = null, val launchTemplateVersion: Output<String>? = null, val networkInterfaces: Output<List<EcsInstanceSetNetworkInterfaceArgs>>? = null, val password: Output<String>? = null, val passwordInherit: Output<Boolean>? = null, val period: Output<Int>? = null, val periodUnit: Output<String>? = null, val ramRoleName: Output<String>? = null, val resourceGroupId: Output<String>? = null, val securityEnhancementStrategy: Output<String>? = null, val securityGroupIds: Output<List<String>>? = null, val spotPriceLimit: Output<Double>? = null, val spotStrategy: Output<String>? = null, val systemDiskAutoSnapshotPolicyId: Output<String>? = null, val systemDiskCategory: Output<String>? = null, val systemDiskDescription: Output<String>? = null, val systemDiskName: Output<String>? = null, val systemDiskPerformanceLevel: Output<String>? = null, val systemDiskSize: Output<Int>? = null, val tags: Output<Map<String, String>>? = null, val uniqueSuffix: Output<Boolean>? = null, val vswitchId: Output<String>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<EcsInstanceSetArgs>

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

NOTE: Available since v1.173.0. NOTE: This resource is used to batch create a group of instance resources with the same configuration. However, this resource is not recommended. alicloud.ecs.Instance is preferred. NOTE: In the instances managed by this resource, names are automatically generated based on instance_name and unique_suffix. NOTE: Only tags support batch modification.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.getZones({
availableDiskCategory: "cloud_efficiency",
availableResourceCreation: "VSwitch",
});
const defaultGetInstanceTypes = _default.then(_default => alicloud.ecs.getInstanceTypes({
availabilityZone: _default.zones?.[0]?.id,
cpuCoreCount: 1,
memorySize: 2,
}));
const defaultGetImages = alicloud.ecs.getImages({
nameRegex: "^ubuntu_18.*64",
mostRecent: true,
owners: "system",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "172.17.3.0/24",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vswitchName: name,
cidrBlock: "172.17.3.0/24",
vpcId: defaultNetwork.id,
zoneId: _default.then(_default => _default.zones?.[0]?.id),
});
const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {
name: name,
vpcId: defaultNetwork.id,
});
const beijingK = new alicloud.ecs.EcsInstanceSet("beijing_k", {
amount: 10,
imageId: defaultGetImages.then(defaultGetImages => defaultGetImages.images?.[0]?.id),
instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.instanceTypes?.[0]?.id),
instanceName: name,
instanceChargeType: "PostPaid",
systemDiskPerformanceLevel: "PL0",
systemDiskCategory: "cloud_efficiency",
systemDiskSize: 200,
vswitchId: defaultSwitch.id,
securityGroupIds: [defaultSecurityGroup].map(__item => __item.id),
zoneId: _default.then(_default => _default.zones?.[0]?.id),
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.get_zones(available_disk_category="cloud_efficiency",
available_resource_creation="VSwitch")
default_get_instance_types = alicloud.ecs.get_instance_types(availability_zone=default.zones[0].id,
cpu_core_count=1,
memory_size=2)
default_get_images = alicloud.ecs.get_images(name_regex="^ubuntu_18.*64",
most_recent=True,
owners="system")
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="172.17.3.0/24")
default_switch = alicloud.vpc.Switch("default",
vswitch_name=name,
cidr_block="172.17.3.0/24",
vpc_id=default_network.id,
zone_id=default.zones[0].id)
default_security_group = alicloud.ecs.SecurityGroup("default",
name=name,
vpc_id=default_network.id)
beijing_k = alicloud.ecs.EcsInstanceSet("beijing_k",
amount=10,
image_id=default_get_images.images[0].id,
instance_type=default_get_instance_types.instance_types[0].id,
instance_name=name,
instance_charge_type="PostPaid",
system_disk_performance_level="PL0",
system_disk_category="cloud_efficiency",
system_disk_size=200,
vswitch_id=default_switch.id,
security_group_ids=[__item&#46;id for __item in [default_security_group]],
zone_id=default.zones[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.GetZones.Invoke(new()
{
AvailableDiskCategory = "cloud_efficiency",
AvailableResourceCreation = "VSwitch",
});
var defaultGetInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
{
AvailabilityZone = @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
CpuCoreCount = 1,
MemorySize = 2,
});
var defaultGetImages = AliCloud.Ecs.GetImages.Invoke(new()
{
NameRegex = "^ubuntu_18.*64",
MostRecent = true,
Owners = "system",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "172.17.3.0/24",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VswitchName = name,
CidrBlock = "172.17.3.0/24",
VpcId = defaultNetwork.Id,
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
});
var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
{
Name = name,
VpcId = defaultNetwork.Id,
});
var beijingK = new AliCloud.Ecs.EcsInstanceSet("beijing_k", new()
{
Amount = 10,
ImageId = defaultGetImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
InstanceName = name,
InstanceChargeType = "PostPaid",
SystemDiskPerformanceLevel = "PL0",
SystemDiskCategory = "cloud_efficiency",
SystemDiskSize = 200,
VswitchId = defaultSwitch.Id,
SecurityGroupIds = new[]
{
defaultSecurityGroup,
}.Select(__item => __item.Id).ToList(),
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example";
if param := cfg.Get("name"); param != ""{
name = param
}
_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableDiskCategory: pulumi.StringRef("cloud_efficiency"),
AvailableResourceCreation: pulumi.StringRef("VSwitch"),
}, nil);
if err != nil {
return err
}
defaultGetInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
AvailabilityZone: pulumi.StringRef(_default.Zones[0].Id),
CpuCoreCount: pulumi.IntRef(1),
MemorySize: pulumi.Float64Ref(2),
}, nil);
if err != nil {
return err
}
defaultGetImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
NameRegex: pulumi.StringRef("^ubuntu_18.*64"),
MostRecent: pulumi.BoolRef(true),
Owners: pulumi.StringRef("system"),
}, nil);
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.17.3.0/24"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("172.17.3.0/24"),
VpcId: defaultNetwork.ID(),
ZoneId: pulumi.String(_default.Zones[0].Id),
})
if err != nil {
return err
}
defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
Name: pulumi.String(name),
VpcId: defaultNetwork.ID(),
})
if err != nil {
return err
}
var splat0 pulumi.StringArray
for _, val0 := range %!v(PANIC=Format method: fatal: An assertion has failed: tok: ) {
splat0 = append(splat0, val0.ID())
}
_, err = ecs.NewEcsInstanceSet(ctx, "beijing_k", &ecs.EcsInstanceSetArgs{
Amount: pulumi.Int(10),
ImageId: pulumi.String(defaultGetImages.Images[0].Id),
InstanceType: pulumi.String(defaultGetInstanceTypes.InstanceTypes[0].Id),
InstanceName: pulumi.String(name),
InstanceChargeType: pulumi.String("PostPaid"),
SystemDiskPerformanceLevel: pulumi.String("PL0"),
SystemDiskCategory: pulumi.String("cloud_efficiency"),
SystemDiskSize: pulumi.Int(200),
VswitchId: defaultSwitch.ID(),
SecurityGroupIds: splat0,
ZoneId: pulumi.String(_default.Zones[0].Id),
})
if err != nil {
return err
}
return nil
})
}
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.EcsInstanceSet;
import com.pulumi.alicloud.ecs.EcsInstanceSetArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableDiskCategory("cloud_efficiency")
.availableResourceCreation("VSwitch")
.build());
final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(default_.zones()[0].id())
.cpuCoreCount(1)
.memorySize(2)
.build());
final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
.nameRegex("^ubuntu_18.*64")
.mostRecent(true)
.owners("system")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.17.3.0/24")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("172.17.3.0/24")
.vpcId(defaultNetwork.id())
.zoneId(default_.zones()[0].id())
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.name(name)
.vpcId(defaultNetwork.id())
.build());
var beijingK = new EcsInstanceSet("beijingK", EcsInstanceSetArgs.builder()
.amount(10)
.imageId(defaultGetImages.images()[0].id())
.instanceType(defaultGetInstanceTypes.instanceTypes()[0].id())
.instanceName(name)
.instanceChargeType("PostPaid")
.systemDiskPerformanceLevel("PL0")
.systemDiskCategory("cloud_efficiency")
.systemDiskSize(200)
.vswitchId(defaultSwitch.id())
.securityGroupIds(defaultSecurityGroup.stream().map(element -> element.id()).collect(toList()))
.zoneId(default_.zones()[0].id())
.build());
}
}

Constructors

Link copied to clipboard
constructor(amount: Output<Int>? = null, autoReleaseTime: Output<String>? = null, autoRenew: Output<Boolean>? = null, autoRenewPeriod: Output<Int>? = null, bootCheckOsWithAssistant: Output<Boolean>? = null, dataDisks: Output<List<EcsInstanceSetDataDiskArgs>>? = null, dedicatedHostId: Output<String>? = null, deletionProtection: Output<Boolean>? = null, deploymentSetId: Output<String>? = null, description: Output<String>? = null, excludeInstanceFilter: Output<EcsInstanceSetExcludeInstanceFilterArgs>? = null, hostName: Output<String>? = null, hpcClusterId: Output<String>? = null, imageId: Output<String>? = null, instanceChargeType: Output<String>? = null, instanceName: Output<String>? = null, instanceType: Output<String>? = null, internetChargeType: Output<String>? = null, internetMaxBandwidthOut: Output<Int>? = null, keyPairName: Output<String>? = null, launchTemplateId: Output<String>? = null, launchTemplateName: Output<String>? = null, launchTemplateVersion: Output<String>? = null, networkInterfaces: Output<List<EcsInstanceSetNetworkInterfaceArgs>>? = null, password: Output<String>? = null, passwordInherit: Output<Boolean>? = null, period: Output<Int>? = null, periodUnit: Output<String>? = null, ramRoleName: Output<String>? = null, resourceGroupId: Output<String>? = null, securityEnhancementStrategy: Output<String>? = null, securityGroupIds: Output<List<String>>? = null, spotPriceLimit: Output<Double>? = null, spotStrategy: Output<String>? = null, systemDiskAutoSnapshotPolicyId: Output<String>? = null, systemDiskCategory: Output<String>? = null, systemDiskDescription: Output<String>? = null, systemDiskName: Output<String>? = null, systemDiskPerformanceLevel: Output<String>? = null, systemDiskSize: Output<Int>? = null, tags: Output<Map<String, String>>? = null, uniqueSuffix: Output<Boolean>? = null, vswitchId: Output<String>? = null, zoneId: Output<String>? = null)

Properties

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

The number of instances that you want to create. Valid values: 1 to 100.

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

The automatic release time of the PostPaid instance.

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

Whether to enable auto-renewal for the instance. This parameter is valid only when the instance_charge_type is set to PrePaid.

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

Auto renewal period of an instance, in the unit of month. It is valid when instance_charge_type is PrePaid.

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

Indicate how to check instance ready to use.

Link copied to clipboard

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

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

The ID of the dedicated host on which to create the instance. If the dedicated_host_id is specified, the spot_strategy and spot_price_limit are ignored. This is because preemptible instances cannot be created on dedicated hosts.

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

Whether to enable release protection for the instance.

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

The ID of the deployment set to which to deploy the instance.

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

The description of the instance, This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://.

Link copied to clipboard

The instances that need to be excluded from the Instance Set. See exclude_instance_filter below.

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

The hostname of instance.

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

The ID of the Elastic High Performance Computing (E-HPC) cluster to which to assign the instance.

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

The Image to use for the instance.

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

The billing method of the instance. Valid values: PrePaid, PostPaid.

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

The name of the ECS. This instance_name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen, and must not begin with http:// or https://.

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

The type of instance to start.

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

The Internet charge type of the instance. Valid values are PayByBandwidth, PayByTraffic.

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

The Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). Valid values: 1 to 100.

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

The name of key pair that can login ECS instance successfully without password.

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

The ID of the launch template.

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

The name of the launch template. To use a launch template to create an instance, you must use the launch_template_id or launch_template_name parameter to specify the launch template.

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

The version of the launch template.

Link copied to clipboard

A list of NetworkInterface. See network_interfaces below..

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

The password to an instance is a string of 8 to 30 characters. It must contain uppercase/lowercase letters and numerals, but cannot contain special symbols.

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

Whether to use the password preset in the image.

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

The duration that you will buy the resource, in month. It is valid when instance_charge_type is PrePaid.

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

The duration unit that you will buy the resource. It is valid when instance_charge_type is 'PrePaid'. Valid value: Week, Month.

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

The Instance RAM role name.

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

The ID of resource group which the instance belongs.

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

The security enhancement strategy.

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

A list of security group ids to associate with.

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

The hourly price threshold of a instance, and it takes effect only when parameter 'spot_strategy' is 'SpotWithPriceLimit'. Three decimals is allowed at most.

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

The spot strategy of a Pay-As-You-Go instance, and it takes effect only when parameter instance_charge_type is 'PostPaid'.

Link copied to clipboard

The ID of the automatic snapshot policy applied to the system disk.

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

The category of the system disk. Valid values are cloud_efficiency, cloud_ssd, cloud_essd, cloud.

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

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

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

The name of the system disk.

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

The performance level of the ESSD used as the system disk. Valid values: PL0, PL1, PL2, PL3.

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

The size of the system disk, measured in GiB. Value range: values: 20 to 500.

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

A mapping of tags to assign to the resource.

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

Whether to automatically append incremental suffixes to the hostname specified by the HostName parameter and to the instance name specified by the InstanceName parameter when you batch create instances. The incremental suffixes can range from 001 to 999.

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

The virtual switch ID to launch in VPC.

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

The ID of the zone in which to create the instance.

Functions

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