---
title: AWS Auto Scaling
description: Launch and terminate EC2 instances based on user-defined policies.
breadcrumbs: Docs > Integrations > AWS Auto Scaling
---

# AWS Auto Scaling

## Overview{% #overview %}

AWS Auto Scaling is a service to launch or terminate EC2 instances automatically based on user-defined policies.

Enable this integration to see all your Auto Scaling metrics in Datadog.

- Collect EC2 metrics for hosts in Auto Scaling groups with the `autoscaling_group` tag.
- Collect Auto Scaling metrics about the specific group with the `autoscaling_group` and `autoscalinggroupname` tags.

## Setup{% #setup %}

### Installation{% #installation %}

If you haven't already, set up the [Amazon Web Services integration](https://docs.datadoghq.com/integrations/amazon_web_services/) first.

### Metric collection{% #metric-collection %}

1. In the Datadog [AWS integration page](https://app.datadoghq.com/integrations/amazon-web-services), ensure that `AutoScaling` is enabled under the `Metric Collection` tab.

1. In AWS, Auto Scaling data must be sent to CloudWatch. See [Enable Auto Scaling Group Metrics](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html#as-enable-group-metrics).

1. Add the following permissions to your [Datadog IAM policy](https://docs.datadoghq.com/integrations/amazon_web_services/#installation) in order to collect AWS Auto Scaling metrics. For more information, see the [Auto Scaling policies](https://docs.aws.amazon.com/autoscaling/plans/userguide/auth-and-access-control.html) on the AWS website.

| AWS Permission                          | Description                                                                                                                                                                                                                         |
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `autoscaling:DescribeAutoScalingGroups` | Used to list all Auto Scaling groups.                                                                                                                                                                                               |
| `autoscaling:DescribePolicies`          | List available policies (for autocompletion in events and monitors).                                                                                                                                                                |
| `autoscaling:DescribeTags`              | Used to list tags for a given Auto Scaling group. This adds ASG custom tags on ASG CloudWatch metrics.                                                                                                                              |
| `autoscaling:DescribeScalingActivities` | Used to generate events when an ASG scales up or down.                                                                                                                                                                              |
| `autoscaling:ExecutePolicy`             | Execute one policy (scale up or down from a monitor or the events feed).This is not included in the installation Policy Document and should only be included if you are using monitors or events to execute an Auto Scaling policy. |

1. Install the [Datadog - AWS Auto Scaling integration](https://app.datadoghq.com/integrations/amazon-auto-scaling).

### Log collection{% #log-collection %}

#### Enable logging{% #enable-logging %}

Configure AWS Auto Scaling to send logs either to a S3 bucket or to CloudWatch.

**Note**: If you log to a S3 bucket, make sure that `amazon_auto_scaling` is set as *Target prefix*.

#### Send logs to Datadog{% #send-logs-to-datadog %}

1. If you haven't already, set up the [Datadog Forwarder Lambda function](https://docs.datadoghq.com/logs/guide/forwarder/).

1. Once the Lambda function is installed, manually add a trigger on the S3 bucket or CloudWatch log group that contains your AWS Auto Scaling logs in the AWS console:

   - [Add a manual trigger on the S3 bucket](https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/#collecting-logs-from-s3-buckets)
   - [Add a manual trigger on the CloudWatch Log Group](https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/#collecting-logs-from-cloudwatch-log-group)

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **aws.autoscaling.group\_desired\_capacity**(gauge)      | The number of instances that the Auto Scaling group attempts to maintain.                                                                                      |
| **aws.autoscaling.group\_in\_service\_instances**(gauge) | The number of instances that are running as part of the Auto Scaling group. This metric does not include instances that are pending or terminating.            |
| **aws.autoscaling.group\_max\_size**(gauge)              | The maximum size of the Auto Scaling group.                                                                                                                    |
| **aws.autoscaling.group\_min\_size**(gauge)              | The minimum size of the Auto Scaling group.                                                                                                                    |
| **aws.autoscaling.group\_pending\_instances**(gauge)     | The number of instances that are pending. A pending instance is not yet in service. This metric does not include instances that are in service or terminating. |
| **aws.autoscaling.group\_terminating\_instances**(gauge) | The number of instances that are in the process of terminating. This metric does not include instances that are in service or pending.                         |
| **aws.autoscaling.group\_total\_instances**(gauge)       | The total number of instances in the Auto Scaling group. This metric identifies the number of instances that are in service and/or pending and/or terminating. |

Each of the metrics retrieved from AWS is assigned the same tags that appear in the AWS console, including but not limited to host name, security-groups, and more.

### Events{% #events %}

The AWS Auto-Scaling integration includes events for launching and terminating EC2 instances. See example events below:

{% image
   source="https://docs.dd-static.net/images/integrations/amazon_auto_scaling/aws_auto_scaling_events.5f613684c695dd1ebef19bdf94fb9dd0.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/integrations/amazon_auto_scaling/aws_auto_scaling_events.5f613684c695dd1ebef19bdf94fb9dd0.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="AWS Auto-Scaling Events" /%}

### Service Checks{% #service-checks %}

The AWS Auto-Scaling integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

In order for the ASG metrics to start appearing in Datadog, first enable them in your AWS console. [See the AWS instructions on how to enable your ASG metrics](http://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-monitoring.html#enable-detailed-instance-metrics). **Note**: It may take a while for such metrics to appear after they have been enabled.

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
