AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

We strongly recommend that all Auto Scaling groups use launch templates to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.

Updates the configuration for the specified Auto Scaling group.

To update an Auto Scaling group, specify the name of the group and the property that you want to change. Any properties that you don't specify are not changed by this update request. The new settings take effect on any scaling activities after this call returns.

If you associate a new launch configuration or template with an Auto Scaling group, all new instances will get the updated configuration. Existing instances continue to run with the configuration that they were originally launched with. When you update a group to specify a mixed instances policy instead of a launch configuration or template, existing instances may be replaced to match the new purchasing options that you specified in the policy. For example, if the group currently has 100% On-Demand capacity and the policy specifies 50% Spot capacity, this means that half of your instances will be gradually terminated and relaunched as Spot Instances. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones, so that updating your group does not compromise the performance or availability of your application.

Note the following about changing DesiredCapacity, MaxSize, or MinSize:

To see which properties have been set, call the DescribeAutoScalingGroups API. To view the scaling policies for an Auto Scaling group, call the DescribePolicies API. If the group has scaling policies, you can update them by calling the PutScalingPolicy API.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to UpdateAutoScalingGroupAsync.

Namespace: Amazon.AutoScaling
Assembly: AWSSDK.AutoScaling.dll
Version: 3.x.y.z

Syntax

C#
public abstract UpdateAutoScalingGroupResponse UpdateAutoScalingGroup(
         UpdateAutoScalingGroupRequest request
)

Parameters

request
Type: Amazon.AutoScaling.Model.UpdateAutoScalingGroupRequest

Container for the necessary parameters to execute the UpdateAutoScalingGroup service method.

Return Value


The response from the UpdateAutoScalingGroup service method, as returned by AutoScaling.

Exceptions

ExceptionCondition
ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
ScalingActivityInProgressException The operation can't be performed because there are scaling activities in progress.
ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.

Examples

This example updates multiple properties at the same time.

To update an Auto Scaling group


var client = new AmazonAutoScalingClient();
var response = client.UpdateAutoScalingGroup(new UpdateAutoScalingGroupRequest 
{
    AutoScalingGroupName = "my-auto-scaling-group",
    LaunchTemplate = new LaunchTemplateSpecification {
        LaunchTemplateName = "my-template-for-auto-scaling",
        Version = "2"
    },
    MaxSize = 5,
    MinSize = 1,
    NewInstancesProtectedFromScaleIn = true
});


            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also