Datadog

Overview

The Datadog add-on attaches a sidecar container to your app’s containers to monitor them and your AWS ECS services. Optionally, a second sidecar container can be enabled to capture all log output from your app containers and forward it to Datadog Logging.

Sidecar Containers

A sidecar container is an additional container that runs alongside your main application container within the same task.

Both containers share the same network namespace and can communicate via localhost. They also share the same lifecycle — they start and stop together.

Purpose and Benefits

  • Infrastructure Monitoring: Automatically collects metrics from your app containers and AWS ECS services and sends them to Datadog
  • Log Aggregation: Optionally capture and forward all container log output to Datadog Logging
  • Tagging: Tag metrics and logs by environment and service name to differentiate apps and environments inside Datadog
  • Simple Setup: One command attaches the Datadog agent sidecar; no manual agent installation or configuration required

How It Works

The Datadog agent sidecar runs alongside your application containers in the same ECS task. It collects container metrics and forwards them to your Datadog account using your API key. When logging is enabled, a second sidecar container captures stdout/stderr from your app containers and ships the logs to Datadog Logging.

Automatic Environment Variables

When you add the Datadog add-on, Tapitalee automatically injects a set of DD_* environment variables into your application containers based on the settings you provide. This includes:

  • DD_API_KEY — set from your datadog_api_key
  • DD_SITE — set from your datadog_site
  • DD_TAGS — populated with appropriate tags (e.g. environment and service name)

You do not need to set these variables manually.

StatsD Metrics

Because the Datadog agent sidecar shares the same network namespace as your application container, it also exposes a StatsD listener on localhost:8125 (UDP). This means your application can send custom StatsD metrics directly to localhost on port 8125 without any additional network configuration — they will be picked up by the agent and forwarded to your Datadog account.

Getting a Datadog API Key

  1. Hover over your account name at the bottom-left of the Datadog UI
  2. Go to Organization Settings
  3. Click on API Keys
  4. Click New API Key and copy the generated key

CLI Usage

Create Datadog Add-On

tapit create datadog datadog_api_key=KEY [datadog_site=datadoghq.com] [datadog_env=production] [datadog_service=myservice] [enable_logging=true|false]

Required Parameters

ParameterDescription
datadog_api_keyYour Datadog API key

Optional Parameters

ParameterDefaultDescription
datadog_sitedatadoghq.comYour Datadog site. Only set this if you are not using the primary US (us-east) Datadog region
datadog_env(none)Environment tag applied to all metrics and logs (e.g. production, staging)
datadog_service(none)Service name tag applied to all metrics and logs. Used to differentiate apps inside Datadog
enable_loggingfalseSet to true to enable a second sidecar container that captures all app log output and forwards it to Datadog Logging

List and Show

# List all addons (including Datadog)
tapit list addons

# Show Datadog addon details
tapit show addon name=datadog

Delete Datadog Add-On

tapit delete addon name=datadog