update_auto_scaling_group ( $auto_scaling_group_name, $opt )

Updates the configuration for the specified AutoScalingGroup.

To update an Auto Scaling group with a launch configuration that has the InstanceMonitoring flag set to False, you must first ensure that collection of group metrics is disabled. Otherwise, calls to UpdateAutoScalingGroup will fail. If you have previously enabled group metrics collection, you can disable collection of all group metrics by calling DisableMetricsCollection.

The new settings are registered upon the completion of this call. Any launch configuration settings take effect on any triggers after this call returns. Triggers that are currently in progress aren’t affected.

  • If a new value is specified for MinSize without specifying the value for DesiredCapacity, and if the new MinSize is larger than the current size of the Auto Scaling Group, there will be an implicit call to SetDesiredCapacity to set the group to the new MinSize.
  • If a new value is specified for MaxSize without specifying the value for DesiredCapacity, and the new MaxSize is smaller than the current size of the Auto Scaling Group, there will be an implicit call to SetDesiredCapacity to set the group to the new MaxSize.
  • All other optional parameters are left unchanged if not passed in the request.

Access

public

Parameters

Parameter

Type

Required

Description

$auto_scaling_group_name

string

Required

The name of the Auto Scaling group. [Constraints: The value must be between 1 and 1600 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • LaunchConfigurationName - string - Optional - The name of the launch configuration. [Constraints: The value must be between 1 and 1600 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]
  • MinSize - integer - Optional - The minimum size of the Auto Scaling group.
  • MaxSize - integer - Optional - The maximum size of the Auto Scaling group.
  • DesiredCapacity - integer - Optional - The desired capacity for the Auto Scaling group.
  • DefaultCooldown - integer - Optional - The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
  • AvailabilityZones - string|array - Optional - Availability Zones for the group. Pass a string for a single value, or an indexed array for multiple values.
  • HealthCheckType - string - Optional - The service of interest for the health status check, either “EC2” for Amazon EC2 or “ELB” for Elastic Load Balancing. [Constraints: The value must be between 1 and 32 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]
  • HealthCheckGracePeriod - integer - Optional - The length of time that Auto Scaling waits before checking an instance’s health status. The grace period begins when an instance comes into service.
  • PlacementGroup - string - Optional - The name of the cluster placement group, if applicable. For more information, go to Using Cluster Instances in the Amazon EC2 User Guide. [Constraints: The value must be between 1 and 255 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]
  • VPCZoneIdentifier - string - Optional - The subnet identifier for the Amazon VPC connection, if applicable. You can specify several subnets in a comma-separated list. When you specify VPCZoneIdentifier with AvailabilityZones, ensure that the subnets’ Availability Zones match the values you specify for AvailabilityZones. [Constraints: The value must be between 1 and 255 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]
  • TerminationPolicies - string|array - Optional - 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 on creating a termination policy for your Auto Scaling group, go to Instance Termination Policy for Your Auto Scaling Group in the the Auto Scaling Developer Guide. Pass a string for a single value, or an indexed array for multiple values.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Update an auto scaling group.

// Instantiate the class
$as = new AmazonAS();

$response = $as->update_auto_scaling_group('my-scaling-group', array(
	'LaunchConfigurationName' => 'my-launch-config',
	'MinSize' => 0,
	'MaxSize' => 2,
	'DesiredCapacity' => 2, // instances
	'DefaultCooldown' => 30, // seconds
	'HealthCheckGracePeriod' => 30, // seconds
	'AvailabilityZones' => array(
		'us-east-1a',
		'us-east-1b',
		'us-east-1c',
		'us-east-1d'
	),
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/as.class.php | Toggle source view (25 lines) | View on GitHub

public function update_auto_scaling_group($auto_scaling_group_name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['AutoScalingGroupName'] = $auto_scaling_group_name;
    
    // Optional list (non-map)
    if (isset($opt['AvailabilityZones']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'AvailabilityZones' => (is_array($opt['AvailabilityZones']) ? $opt['AvailabilityZones'] : array($opt['AvailabilityZones']))
        ), 'member'));
        unset($opt['AvailabilityZones']);
    }
    
    // Optional list (non-map)
    if (isset($opt['TerminationPolicies']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'TerminationPolicies' => (is_array($opt['TerminationPolicies']) ? $opt['TerminationPolicies'] : array($opt['TerminationPolicies']))
        ), 'member'));
        unset($opt['TerminationPolicies']);
    }

    return $this->authenticate('UpdateAutoScalingGroup', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback