CreateAutoScalingGroup#

Description#

Creates an Auto Scaling Group (ASG).

Request Parameters#

Required parameters#

  • AutoScalingGroupName — The name of the ASG.

    • Type: String

    • Required: Yes

    • Constraints: 1 to 255 ASCII characters

  • LaunchTemplate — The launch template to use to launch instances.

  • MaxSize — The maximum capacity of the ASG.

    • Type: Integer

    • Required: Yes

  • MinSize — The minimal capacity of the ASG.

    • Type: Integer

    • Required: Yes

  • VPCZoneIdentifier — The IDs of the subnets in which instances will be created.

    • Type: String

    • Required: Yes

    • Restrictions: you can specify not more than one subnet in each availability zone. All subnets should belong to the same VPC

    • Patterns: subnet-xxxxxxxx | subnet-xxxxxxxx,subnet-yyyyyyyy | subnet-xxxxxxxx,subnet-yyyyyyyy,subnet-zzzzzzzz

    • Note: The primary network interface will be attached to the first specified subnet instead of that defined in the launch template (if applicable)

Optional parameters#

  • DefaultCooldown — The time (in seconds) after which the next activity can start. Used as the default value for the Cooldown parameter when creating/updating policies in this ASG. For SimpleScaling policies only.

    • Type: Integer

    • Required: No

    • Default value: 300

  • DesiredCapacity — The desired capacity of the ASG.

    • Type: Integer

    • Required: No

    • Constraints: The value should greater or equal than MinSize and less and equal than MaxSize

    • Default value: MinSize

  • HealthCheckGracePeriod — The time (in seconds) after which ASG can perform a health check on its instances.

    • Type: Integer

    • Required: No

    • Default value: 0

  • NewInstancesProtectedFromScaleIn — Indicates whether new instances are protected from deletion when ASG is scaled in.

    • Type: Boolean

    • Required: No

    • Default value: False

  • Tags — The ASG tags. If PropagateAtLaunch = True, then the tag is also assigned to the newly created instances. The ASG tags take precedence over the launch template tags with the same keys.

  • TerminationPolicies — List of criteria to select instances for deletion when their number has to be reduced. The criteria will be applied in the order in which they are listed.

    • Type: Array of strings

    • Required: No

    • Valid value: OldestInstance | NewestInstance | OldestLaunchTemplate

    • Default value: OldestInstance

Examples#

c2-as CreateAutoScalingGroup AutoScalingGroupName "asg_name" VPCZoneIdentifier "subnet-xxxxxxxx" LaunchTemplate.LaunchTemplateId "lt-xxxxxxxx" MaxSize 5 MinSize 0 DesiredCapacity 2 DefaultCooldown 60 HealthCheckGracePeriod 60 NewInstancesProtectedFromScaleIn True Tags.1.Key key1 Tags.1.Value value1 Tags.1.PropagateAtLaunch True TerminationPolicies.1 OldestInstance