Updates the configuration for the specified Auto Scaling group.
autoscaling_update_auto_scaling_group(AutoScalingGroupName,
LaunchConfigurationName, LaunchTemplate, MixedInstancesPolicy, MinSize,
MaxSize, DesiredCapacity, DefaultCooldown, AvailabilityZones,
HealthCheckType, HealthCheckGracePeriod, PlacementGroup,
VPCZoneIdentifier, TerminationPolicies,
NewInstancesProtectedFromScaleIn, ServiceLinkedRoleARN)
[required] The name of the Auto Scaling group.
The name of the launch configuration. If you specify this parameter, you can't specify a launch template or a mixed instances policy.
The launch template and version to use to specify the updates. If you specify this parameter, you can't specify a launch configuration or a mixed instances policy.
The mixed instances policy to use to specify the updates. If you specify this parameter, you can't specify a launch configuration or a launch template.
For more information, see Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide.
The minimum size of the Auto Scaling group.
The maximum size of the Auto Scaling group.
The number of EC2 instances that should be running in the Auto Scaling group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
The amount of time, in seconds, after a scaling activity completes
before another scaling activity can start. The default value is 300
.
For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide.
One or more Availability Zones for the group.
The service to use for the health checks. The valid values are EC2
and
ELB
. If you configure an Auto Scaling group to use ELB health checks,
it considers the instance unhealthy if it fails either the EC2 status
checks or the load balancer health checks.
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits
before checking the health status of an EC2 instance that has come into
service. The default value is 0
.
For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide.
Conditional: This parameter is required if you are adding an ELB
health check.
The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances.
A comma-separated list of subnet IDs, if you are launching into a VPC.
If you specify VPCZoneIdentifier
with AvailabilityZones
, the subnets
that you specify for this parameter must reside in those Availability
Zones.
A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide.
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide.
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide.
svc$update_auto_scaling_group( AutoScalingGroupName = "string", LaunchConfigurationName = "string", LaunchTemplate = list( LaunchTemplateId = "string", LaunchTemplateName = "string", Version = "string" ), MixedInstancesPolicy = list( LaunchTemplate = list( LaunchTemplateSpecification = list( LaunchTemplateId = "string", LaunchTemplateName = "string", Version = "string" ), Overrides = list( list( InstanceType = "string" ) ) ), InstancesDistribution = list( OnDemandAllocationStrategy = "string", OnDemandBaseCapacity = 123, OnDemandPercentageAboveBaseCapacity = 123, SpotAllocationStrategy = "string", SpotInstancePools = 123, SpotMaxPrice = "string" ) ), MinSize = 123, MaxSize = 123, DesiredCapacity = 123, DefaultCooldown = 123, AvailabilityZones = list( "string" ), HealthCheckType = "string", HealthCheckGracePeriod = 123, PlacementGroup = "string", VPCZoneIdentifier = "string", TerminationPolicies = list( "string" ), NewInstancesProtectedFromScaleIn = TRUE|FALSE, ServiceLinkedRoleARN = "string" )
The new settings take effect on any scaling activities after this call returns. Scaling activities that are currently in progress aren't affected.
To update an Auto Scaling group with a launch configuration with
InstanceMonitoring
set to false
, you must first disable the
collection of group metrics. Otherwise, you get an error. If you have
previously enabled the collection of group metrics, you can disable it
using DisableMetricsCollection.
Note the following:
If you specify a new value for MinSize
without specifying a value
for DesiredCapacity
, and the new MinSize
is larger than the
current size of the group, we implicitly call SetDesiredCapacity to
set the size of the group to the new value of MinSize
.
If you specify a new value for MaxSize
without specifying a value
for DesiredCapacity
, and the new MaxSize
is smaller than the
current size of the group, we implicitly call SetDesiredCapacity to
set the size of the group to the new value of MaxSize
.
All other optional parameters are left unchanged if not specified.
# NOT RUN {
# This example updates the launch configuration of the specified Auto
# Scaling group.
# }
# NOT RUN {
svc$update_auto_scaling_group(
AutoScalingGroupName = "my-auto-scaling-group",
LaunchConfigurationName = "new-launch-config"
)
# }
# NOT RUN {
# This example updates the minimum size and maximum size of the specified
# Auto Scaling group.
# }
# NOT RUN {
svc$update_auto_scaling_group(
AutoScalingGroupName = "my-auto-scaling-group",
MaxSize = 3L,
MinSize = 1L
)
# }
# NOT RUN {
# This example enables instance protection for the specified Auto Scaling
# group.
# }
# NOT RUN {
svc$update_auto_scaling_group(
AutoScalingGroupName = "my-auto-scaling-group",
NewInstancesProtectedFromScaleIn = TRUE
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab