:doc:`AutoScaling <../../autoscaling>` / Client / set_desired_capacity

********************
set_desired_capacity
********************



.. py:method:: AutoScaling.Client.set_desired_capacity(**kwargs)

  

  Sets the size of the specified Auto Scaling group.

   

  If a scale-in activity occurs as a result of a new ``DesiredCapacity`` value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.

   

  For more information, see `Manual scaling <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scaling-manually.html>`__ in the *Amazon EC2 Auto Scaling User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetDesiredCapacity>`_  


  **Request Syntax**
  ::

    response = client.set_desired_capacity(
        AutoScalingGroupName='string',
        DesiredCapacity=123,
        HonorCooldown=True|False
    )
    
  :type AutoScalingGroupName: string
  :param AutoScalingGroupName: **[REQUIRED]** 

    The name of the Auto Scaling group.

    

  
  :type DesiredCapacity: integer
  :param DesiredCapacity: **[REQUIRED]** 

    The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.

    

  
  :type HonorCooldown: boolean
  :param HonorCooldown: 

    Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the cooldown period during manual scaling activities.

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`AutoScaling.Client.exceptions.ScalingActivityInProgressFault`

  
  *   :py:class:`AutoScaling.Client.exceptions.ResourceContentionFault`

  

  **Examples**

  This example sets the desired capacity for the specified Auto Scaling group.
  ::

    response = client.set_desired_capacity(
        AutoScalingGroupName='my-auto-scaling-group',
        DesiredCapacity=2,
        HonorCooldown=True,
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  