Datadog Cloud Integration: Setup and Cost Optimization

Datadog Cloud Integration: Setup and Cost Optimization
Photo by Lerone Pieters / Unsplash

To achieve a comprehensive monitoring setup for your infrastructure, it’s essential to integrate cloud provider data into Datadog. Datadog supports integrations with major cloud providers, allowing you to streamline monitoring, optimize costs, and ensure a unified view of your system’s health.

This guide will take you through the key features of each cloud integration, focusing on the integration process, cost optimization, and methods to improve data freshness.

Global Integration Behavior

Crawling and Data Collection

Datadog utilizes crawlers that periodically fetch data from various cloud services, typically every 5 to 10 minutes. These crawlers gather metrics and other important data (e.g. tags) from the cloud provider’s monitoring APIs.

However, there might be slight delays in the data collection due to the inherent latency in cloud providers' APIs as well as the crawler frequency mentioned. The main two solutions are mentioned below but more specific solutions may be available, check the relevant section for it.

  • Increasing Fetch Frequency:
    If you require more up-to-date data, you can request Datadog support to increase the fetch frequency. Keep in mind, increasing the frequency of API calls can result in higher costs from the cloud provider.
  • Native Data Collection:
    Certain data, such as host-level metrics, can be collected directly through the Datadog Agent, which ensures more granular and real-time data collection compared to the crawlers.

Why setting up a cloud provider integration?

While the Datadog Agent provides a detailed view of your infrastructure, some cloud services cannot be monitored by the agent alone. These services require integration with Datadog to pull data via cloud provider APIs, allowing you to consolidate all monitoring data (e.g., logs, APM, metrics) into one unified dashboard.

In addition, cloud integrations enable Datadog to enrich your monitored assets with additional metadata (tags), providing a deeper level of insight into your data.

Cost Optimization

Reducing Cloud and Datadog Costs

By integrating cloud providers with Datadog, you can optimize your costs in several ways:

  • Asset Deduplication:
    Datadog ensures that if a cloud-hosted asset (e.g., an EC2 instance or a serverless lambda) is monitored both through the cloud integration and the Datadog Agent, you will only be billed once for that asset.
  • Excluding Non-Essential Assets:
    For cost optimization, Datadog provides options to exclude specific assets, such as unused instances, from being monitored, thus reducing the number of monitored assets and, consequently, your costs. You can create automated allowlists and denylists for more granular control. More details will be provided below.

Cloud Provider Billing

Cloud providers may charge for API calls, and Datadog integrates with cloud APIs to collect data. To minimize cloud provider billing, you can limit the scope of crawlers, excluding non-essential services or regions from being monitored. Again, more details for each provider will be given below.

AWS

Initial setup

Setting up the AWS integration is simple with Datadog’s CloudFormation template, which handles the configuration of roles, permissions to enable the crawler to fetch the data, and the installation of the Datadog Forwarder Lambda. For those who prefer Terraform, an alternative setup guide is also available.

To go beyond, if you create and delete AWS accounts on a regular basis, a multi-account setup is also available https://docs.datadoghq.com/integrations/guide/aws-organizations-setup/

Using AWS PrivateLink can help reduce egress costs when connecting Datadog to AWS. This feature is currently available in specific regions like US1 and API1.

Connect to Datadog over AWS PrivateLink
Datadog, the leading service for cloud-scale monitoring.

Increase metrics freshness

To enhance the freshness of metrics, a few options are available.

Control costs

The Datadog Billing is related to the number of monitored assets such as hosts or lambdas. For large AWS accounts, it may be relevant to exclude some assets from being monitored. https://docs.datadoghq.com/account_management/billing/aws/#aws-resource-exclusion For this reason, it is possible to use tags to limit the resource collection.

Metric collection setup on an AWS integration tile

The AWS billing related to monitoring is often related to the number of API calls. The solution is to disable metrics from specific services and from specific regions.

AWS integration service selection to monitor
AWS integration regions to monitor

What is this Datadog Forwarder?

The Datadog Forwarder is an AWS Lambda function designed to send logs from AWS to Datadog, including:

  • CloudWatch and S3 logs
  • Logs from SNS and Kinesis events (note: Kinesis data stream events support only CloudWatch logs)
  • Metrics, traces, and logs from AWS Lambda functions

While the Datadog Forwarder can be used to forward metrics, traces, and logs from Lambda functions, Datadog recommends using the Datadog Lambda Extension for direct telemetry collection from Lambda execution environments. The Forwarder remains available for serverless monitoring, but it will no longer receive updates to support new features.

Datadog Forwarder
Datadog, the leading service for cloud-scale monitoring.

Azure

Initial setup

Standard Azure Integration

The standard Azure integration requires setting up an app registration with specific permissions to monitor your resources. This setup enables Datadog to collect metrics and platform logs from Azure using an Event Hub.

To go beyond, you can assign read permissions at the management group level when creating the app registration in Azure, to monitor multiple subscriptions and have new subscriptions in the management group automatically monitored.

Native Azure Integration (only for us3)

On US3, a more robust and simpler solution is available usign the Azure Native Integration. To manage it, Datadog provides a detailed guide to modify the script of the resource, configure the metric and log collection.

Bonus: Agent Installation

In addition, with Azure, the Datadog Agent can be deployed on all VMs with the use of the Azure VM Extension. For AKS, a cluster extension is also available to reduce the complexity of managing a third party tool.

Other more generic deployments are still available, but it provides an additional managed option for Azure cloud users.

Increase metrics freshness

To enhance the freshness of metrics, the standard options available are:

  • Use the Datadog Agent and some native integrations. For instance, the host level metrics are also captured by the agent almost instantly and it is similar with other integrations such as Redis.
  • Ask support to increase crawling frequency. Note that is may impact your Azure bill regarding those additional API calls.

Control costs

Similar to AWS, Datadog automatically collects data from all VMs, serverless applications, and other resources. However, some of this data may incur additional charges on the Datadog side. To manage this, you can use tagging to create an automated allowlist or denylist based on your configuration.

Metric collection filter for Datadog Azure integration

Like AWS, Azure charges for API usage. To control costs, you can limit the number of services from which metrics are collected. This can be done by customizing the integration settings and excluding unnecessary services.

For more details, refer to the Azure billing documentation and explore the Native Azure Integration options and configuration for more efficient metric collection.

GCP

Initial setup

The GCP integration follows similar steps to AWS and Azure, requiring the setup of permissions and service account impersonation. This setup ensures that Datadog crawlers can access and monitor your GCP resources.

To monitor all projects within a service, make sure to use a service account impersonation.

Increase metrics freshness

To enhance the freshness of metrics, the standard options available are:

  • Use the Datadog Agent and some native integrations. For instance, the host level metrics are also captured by the agent almost instantly and it is similar with other integrations such as Redis.
  • Ask support to increase crawling frequency. Note that is may impact your Azure bill regarding those additional API calls.

Control costs

As with other cloud providers, you can use an allowlist or denylist to monitor only specific assets that may incur Datadog charges, or to exclude certain assets that are not relevant to your monitoring setup.

To control costs on GCP, you can limit metric collection by namespace. Similar to AWS, you can choose which services to collect data from, reducing the number of API calls made by the Datadog crawler and, in turn, minimizing the potential GCP API charges.

GCP Integration Metric Collection Configuration

By integrating your cloud providers with Datadog, you achieve a unified view of your infrastructure, enhance data freshness, and optimize both Datadog and cloud provider costs. For detailed integration guides for AWS, Azure, and GCP, refer to the documentation or contact Datadog support for tailored assistance.

At Dataiker, we focus on providing instant feedback to help you optimize your setup. If you're interested, feel free to subscribe at app.dataiker.com.

Read more