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.

Container for the parameters to the UpdateAutoScalingGroup operation. Updates the configuration for the specified Auto Scaling group.

To update an Auto Scaling group, specify the name of the group and the parameter that you want to change. Any parameters 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 parameters have been set, use DescribeAutoScalingGroups. You can also view the scaling policies for an Auto Scaling group using DescribePolicies. If the group has scaling policies, you can update them using PutScalingPolicy.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.AutoScaling.AmazonAutoScalingRequest
      Amazon.AutoScaling.Model.UpdateAutoScalingGroupRequest

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

Syntax

C#
public class UpdateAutoScalingGroupRequest : AmazonAutoScalingRequest
         IAmazonWebServiceRequest

The UpdateAutoScalingGroupRequest type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property AutoScalingGroupName System.String

Gets and sets the property AutoScalingGroupName.

The name of the Auto Scaling group.

Public Property AvailabilityZones System.Collections.Generic.List<System.String>

Gets and sets the property AvailabilityZones.

One or more Availability Zones for the group.

Public Property DefaultCooldown System.Int32

Gets and sets the property DefaultCooldown.

The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300. This cooldown period is not used when a scaling-specific cooldown is specified.

Cooldown periods are not supported for target tracking scaling policies, step scaling policies, or scheduled scaling. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide.

Public Property DesiredCapacity System.Int32

Gets and sets the property DesiredCapacity.

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.

Public Property HealthCheckGracePeriod System.Int32

Gets and sets the property HealthCheckGracePeriod.

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 Check Grace Period in the Amazon EC2 Auto Scaling User Guide.

Conditional: This parameter is required if you are adding an ELB health check.

Public Property HealthCheckType System.String

Gets and sets the property HealthCheckType.

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.

Public Property LaunchConfigurationName System.String

Gets and sets the property LaunchConfigurationName.

The name of the launch configuration. If you specify LaunchConfigurationName in your update request, you can't specify LaunchTemplate or MixedInstancesPolicy.

Public Property LaunchTemplate Amazon.AutoScaling.Model.LaunchTemplateSpecification

Gets and sets the property LaunchTemplate.

The launch template and version to use to specify the updates. If you specify LaunchTemplate in your update request, you can't specify LaunchConfigurationName or MixedInstancesPolicy.

For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference.

Public Property MaxInstanceLifetime System.Int32

Gets and sets the property MaxInstanceLifetime.

The maximum amount of time, in seconds, that an instance can be in service.

For more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide.

Valid Range: Minimum value of 604800.

Public Property MaxSize System.Int32

Gets and sets the property MaxSize.

The maximum size of the Auto Scaling group.

Public Property MinSize System.Int32

Gets and sets the property MinSize.

The minimum size of the Auto Scaling group.

Public Property MixedInstancesPolicy Amazon.AutoScaling.Model.MixedInstancesPolicy

Gets and sets the property MixedInstancesPolicy.

An embedded object that specifies a mixed instances policy.

In your call to UpdateAutoScalingGroup, you can make changes to the policy that is specified. All optional parameters are left unchanged if not specified.

For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide.

Public Property NewInstancesProtectedFromScaleIn System.Boolean

Gets and sets the property NewInstancesProtectedFromScaleIn.

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.

Public Property PlacementGroup System.String

Gets and sets the property PlacementGroup.

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.

Public Property ServiceLinkedRoleARN System.String

Gets and sets the property ServiceLinkedRoleARN.

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.

Public Property TerminationPolicies System.Collections.Generic.List<System.String>

Gets and sets the property TerminationPolicies.

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.

Public Property VPCZoneIdentifier System.String

Gets and sets the property VPCZoneIdentifier.

A comma-separated list of subnet IDs for virtual private cloud (VPC).

If you specify VPCZoneIdentifier with AvailabilityZones, the subnets that you specify for this parameter must reside in those Availability Zones.

Examples

This example updates the launch configuration of the specified Auto Scaling group.

To update the launch configuration


var response = client.UpdateAutoScalingGroup(new UpdateAutoScalingGroupRequest 
{
    AutoScalingGroupName = "my-auto-scaling-group",
    LaunchConfigurationName = "new-launch-config"
});


            

This example updates the minimum size and maximum size of the specified Auto Scaling group.

To update the minimum and maximum size


var response = client.UpdateAutoScalingGroup(new UpdateAutoScalingGroupRequest 
{
    AutoScalingGroupName = "my-auto-scaling-group",
    MaxSize = 3,
    MinSize = 1
});


            

This example enables instance protection for the specified Auto Scaling group.

To enable instance protection


var response = client.UpdateAutoScalingGroup(new UpdateAutoScalingGroupRequest 
{
    AutoScalingGroupName = "my-auto-scaling-group",
    NewInstancesProtectedFromScaleIn = true
});


            

Version Information

.NET Standard:
Supported in: 1.3

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

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms