ScalingGroupArgs

data class ScalingGroupArgs(val dbInstanceIds: Output<List<String>>? = null, val defaultCooldown: Output<Int>? = null, val desiredCapacity: Output<Int>? = null, val groupDeletionProtection: Output<Boolean>? = null, val groupType: Output<String>? = null, val healthCheckType: Output<String>? = null, val launchTemplateId: Output<String>? = null, val launchTemplateVersion: Output<String>? = null, val loadbalancerIds: Output<List<String>>? = null, val maxSize: Output<Int>? = null, val minSize: Output<Int>? = null, val multiAzPolicy: Output<String>? = null, val onDemandBaseCapacity: Output<Int>? = null, val onDemandPercentageAboveBaseCapacity: Output<Int>? = null, val protectedInstances: Output<List<String>>? = null, val removalPolicies: Output<List<String>>? = null, val scalingGroupName: Output<String>? = null, val spotInstancePools: Output<Int>? = null, val spotInstanceRemedy: Output<Boolean>? = null, val tags: Output<Map<String, Any>>? = null, val vswitchId: Output<String>? = null, val vswitchIds: Output<List<String>>? = null) : ConvertibleToJava<ScalingGroupArgs>

Provides a ESS scaling group resource which is a collection of ECS instances with the same application scenarios. It defines the maximum and minimum numbers of ECS instances in the group, and their associated Server Load Balancer instances, RDS instances, and other attributes.

NOTE: You can launch an ESS scaling group for a VPC network via specifying parameter vswitch_ids. For information about ess scaling rule, see CreateScalingGroup. NOTE: Available since v1.39.0.

Example 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.SecurityGroupRule;
import com.pulumi.alicloud.ecs.SecurityGroupRuleArgs;
import com.pulumi.alicloud.ess.ScalingGroup;
import com.pulumi.alicloud.ess.ScalingGroupArgs;
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 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()))
.cpuCoreCount(2)
.memorySize(4)
.build());
final var defaultImages = EcsFunctions.getImages(GetImagesArgs.builder()
.nameRegex("^ubuntu_18.*64")
.mostRecent(true)
.owners("system")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(name)
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultSecurityGroupRule = new SecurityGroupRule("defaultSecurityGroupRule", SecurityGroupRuleArgs.builder()
.type("ingress")
.ipProtocol("tcp")
.nicType("intranet")
.policy("accept")
.portRange("22/22")
.priority(1)
.securityGroupId(defaultSecurityGroup.id())
.cidrIp("172.16.0.0/24")
.build());
var default2 = new Switch("default2", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.1.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(String.format("%s-bar", name))
.build());
var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()
.minSize(1)
.maxSize(1)
.scalingGroupName(name)
.defaultCooldown(20)
.vswitchIds(
defaultSwitch.id(),
default2.id())
.removalPolicies(
"OldestInstance",
"NewestInstance")
.build());
}
}

Module Support

You can use to the existing autoscaling module to create a scaling group, configuration and lifecycle hook one-click.

Import

ESS scaling group can be imported using the id, e.g.

$ pulumi import alicloud:ess/scalingGroup:ScalingGroup example asg-abc123456

Constructors

Link copied to clipboard
fun ScalingGroupArgs(dbInstanceIds: Output<List<String>>? = null, defaultCooldown: Output<Int>? = null, desiredCapacity: Output<Int>? = null, groupDeletionProtection: Output<Boolean>? = null, groupType: Output<String>? = null, healthCheckType: Output<String>? = null, launchTemplateId: Output<String>? = null, launchTemplateVersion: Output<String>? = null, loadbalancerIds: Output<List<String>>? = null, maxSize: Output<Int>? = null, minSize: Output<Int>? = null, multiAzPolicy: Output<String>? = null, onDemandBaseCapacity: Output<Int>? = null, onDemandPercentageAboveBaseCapacity: Output<Int>? = null, protectedInstances: Output<List<String>>? = null, removalPolicies: Output<List<String>>? = null, scalingGroupName: Output<String>? = null, spotInstancePools: Output<Int>? = null, spotInstanceRemedy: Output<Boolean>? = null, tags: Output<Map<String, Any>>? = null, vswitchId: Output<String>? = null, vswitchIds: Output<List<String>>? = null)

Functions

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

Properties

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

If an RDS instance is specified in the scaling group, the scaling group automatically attaches the Intranet IP addresses of its ECS instances to the RDS access whitelist.

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

Default cool-down time (in seconds) of the scaling group. Value range: 0, 86400. The default value is 300s.

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

Expected number of ECS instances in the scaling group. Value range: min_size, max_size.

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

Specifies whether the scaling group deletion protection is enabled. true or false, Default value: false.

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

Resource type within scaling group. Optional values: ECS, ECI. Default to ECS.

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

Resource type within scaling group. Optional values: ECS, NONE. Default to ECS.

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

Instance launch template ID, scaling group obtains launch configuration from instance launch template, see Launch Template. Creating scaling group from launch template enable group automatically.

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

The version number of the launch template. Valid values are the version number, Latest, or Default, Default value: Default.

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

If a Server Load Balancer instance is specified in the scaling group, the scaling group automatically attaches its ECS instances to the Server Load Balancer instance.

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

Maximum number of ECS instances in the scaling group. Value range: 0, 2000. NOTE: From version 1.204.1, max_size can be set to 2000.

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

Minimum number of ECS instances in the scaling group. Value range: 0, 2000. NOTE: From version 1.204.1, min_size can be set to 2000.

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

Multi-AZ scaling group ECS instance expansion and contraction strategy. PRIORITY, BALANCE or COST_OPTIMIZED(Available in 1.54.0+).

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

The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.

Link copied to clipboard

Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity.

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

Set or unset instances within group into protected status.

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

RemovalPolicy is used to select the ECS instances you want to remove from the scaling group when multiple candidates for removal exist. Optional values:

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

Name shown for the scaling group, which must contain 2-64 characters (English or Chinese), starting with numbers, English letters or Chinese characters, and can contain numbers, underscores _, hyphens -, and decimal points .. If this parameter is not specified, the default value is ScalingGroupId.

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

The number of Spot pools to use to allocate your Spot capacity. The Spot pools is composed of instance types of lowest price.

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

Whether to replace spot instances with newly created spot/onDemand instance when receive a spot recycling message.

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

A mapping of tags to assign to the resource.

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

It has been deprecated from version 1.7.1 and new field 'vswitch_ids' replaces it.

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

List of virtual switch IDs in which the ecs instances to be launched.