Join us at the Dash conference! July 16-17, NYC

AWS EC2

Crawler Crawler

Overview

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.

Enable this integration to see in Datadog all your EC2 metrics, and additional events like scheduled maintenances.

Setup

Installation

If you haven’t already, set up the Amazon Web Services integration first.

Configuration

  1. In the AWS integration tile, ensure that EC2 is checked under metric collection.

  2. Add the following permissions to your Datadog IAM policy in order to collect Amazon EC2 metrics. For more information on EC2 policies, review the documentation on the AWS website.

    AWS Permission Description
    ec2:DescribeInstanceStatus Used by the ELB integration to assert the health of an instance. Used by the EC2 integration to describe the health of all instances.
    ec2:DescribeSecurityGroups Adds SecurityGroup names and custom tags to ec2 instances.
    ec2:DescribeInstances Adds tags to ec2 instances and ec2 cloudwatch metrics.
  3. Install the Datadog - AWS EC2 integration.

Note: If you want to monitor a subset of your EC2 instances with Datadog, assign an AWS tag, such as datadog:true, to those EC2 instances. Then specify that tag in the Optionally limit metrics collection textbox in your Datadog AWS integration tile.

EC2 automuting

Datadog can proactively mute monitors related to the manual shutdown of EC2 instances and instance termination triggered by AWS autoscaling based on host statuses from the Cloudwatch API. Automuted EC2 instances are listed on the Monitor Downtime page by checking Show automatically muted hosts.

Note, the EC2 integration must be installed for automuting to take effect. If metrics collection is limited to hosts with tags, only instances matching the tags are automuted.

To silence monitors for expected EC2 instance shutdowns, check the EC2 automuting box in the AWS integration tile:

Install the Agent with AWS Systems Manager

Follow the steps below to install the Datadog Agent on an EC2 instance with AWS Systems Manager. See [](https://docs.datadoghq.com/agent/faq/why-should-i-install-the-agent-on-my-cloud-instances/#pagetitle) to learn the benefit of installing the Agent on your AWS EC2 instances.

Parameter Store

In the Parameter Store, create a parameter with:

  • Name: dd-api-key-for-ssm
  • Description: (Optional)
  • Type: SecureString
  • KMS key source: My current account
  • KMS Key ID: Use the default value selected.
  • Value: Your Datadog API key

Systems Manager

Documents

In the Systems Manager, create a new Document:

  • Name: dd-agent-install
  • Target type: (Optional)
  • Document type: Command document
  • Content: JSON

If you are in Datadog US site, use the file dd-agent-install-us-site.json updated with your <AWS_REGION> under runCommand (e.g. us-east-1). If you are in Datadog EU site, use the dd-agent-install-eu-site.json instead.

Run Command

Under Run Command, click the Run command button and follow the steps below:

  • Command document:
    • Click on the search box and select Owner -> Owned by me.
    • Click the radio button next to your document.
    • If necessary, choose the Document version.
  • Targets:
    • Select the EC2 instance to target.
  • Output options (optional):
    • Select the CloudWatch output checkbox to log any issues.
  • Other sections (optional):
    • Modify other sections as needed for your setup.

Click the Run button and a confirmation page displays showing the status. Wait for it to finish, then check the Infrastructure list in Datadog.

Log collection

Use the Datadog Agent or another log shipper to send your logs to Datadog.

Data Collected

Metrics

aws.ec2.cpucredit_balance
(gauge)
Number of CPU credits that an instance has accumulated.
shown as unit
aws.ec2.cpucredit_usage
(gauge)
Number of CPU credits consumed.
shown as unit
aws.ec2.cpuutilization
(gauge)
Average percentage of allocated EC2 compute units that are currently in use on the instance.
shown as percent
aws.ec2.cpuutilization.maximum
(gauge)
Maximum percentage of allocated EC2 compute units that are currently in use on the instance.
shown as percent
aws.ec2.disk_read_bytes
(gauge)
Bytes read from all ephemeral disks available to the instance.
shown as byte
aws.ec2.disk_read_ops
(gauge)
Completed read operations from all ephemeral disks available to the instance.
shown as operation
aws.ec2.disk_write_bytes
(gauge)
Bytes written to all ephemeral disks available to the instance.
shown as byte
aws.ec2.disk_write_ops
(gauge)
Completed write operations to all ephemeral disks available to the instance.
shown as operation
aws.ec2.network_in
(gauge)
Average number of bytes received on all network interfaces by the instance.
shown as byte
aws.ec2.network_in.maximum
(gauge)
Maximum number of bytes received on all network interfaces by the instance.
shown as byte
aws.ec2.network_out
(gauge)
Average number of bytes sent out on all network interfaces by the instance.
shown as byte
aws.ec2.network_out.maximum
(gauge)
Maximum number of bytes sent out on all network interfaces by the instance.
shown as byte
aws.ec2.network_packets_in
(gauge)
Number of packets received on all network interfaces by the instance
shown as packet
aws.ec2.network_packets_out
(gauge)
Number of packets sent out on all network interfaces by the instance
shown as packet
aws.ec2.status_check_failed
(gauge)
1 if one of the status checks failed.
aws.ec2.status_check_failed_instance
(gauge)
0 if the instance has passed the EC2 instance status check.
aws.ec2.status_check_failed_system
(gauge)
0 if the instance has passed the EC2 system status check.
aws.ec2.host_ok
(gauge)
1 if the instance's system status is ok.
aws.ec2.instance_age
(gauge)
Time since instance launch
shown as second

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.

Note: aws.ec2.instance_age is not collected by default with Datadog - EC2 integration. Contact us to enable this metric collection.

Service Checks

The AWS EC2 integration does not include any service checks.

Events

The AWS EC2 integration includes events for scheduled and upcoming maintenance along with instance warnings. See example events below:

Troubleshooting

Need help? Contact Datadog support.

Further Reading