Guides
Integrations
Datadog
Support for Fargate

Datadog Support for Fargate

Bringing Fargate Metrics into Datadog requires a special agent that can be added to any Fargate container.

Datadog has written a nice guide for installing the agent manually (opens in a new tab).

This manual integration will not work with Flightcontrol services, unfortunately. With Flightcontrol, the Task Definition gets overridden with each new deployment.

What we need to do is add a Datadog agent as a sidecar to the service. For more info on sidecars, see the related documentation.

  1. In your flightcontrol.json file, you will need to add a sidecars property with the Datadog agent image.
  2. You may also add Docker Labels, so Datadog can correctly tag the logs and metrics.

Here is a complete example:

{
  "id": "web",
  "name": "web",
  "type": "fargate",
  "cpu": 0.5,
  "memory": 1,
  "minInstances": 1,
  "maxInstances": 1,
  "dockerLabels": {
    "com.datadoghq.ad.instances": "[{\"host\": \"%%host%%\", \"port\": 3000}]", //change the port if needed
    "com.datadoghq.ad.check_names": "[\"DISPLAY_NAME\"]", // name that will show in datadog
    "com.datadoghq.ad.init_configs": "[{}]",
    "com.datadoghq.tags.env": "production"
  },
  "sidecars": [
    {
      "name": "datadog-agent",
      "image": "public.ecr.aws/datadog/agent:latest",
      "cpuAllotment": 0.5,
      "memoryAllotment": 0.5,
      "logging": false,
      "envVariables": {
        "DD_API_KEY": {
          "fromParameterStore": "your.parameter.store.api-key"
        },
        "DD_ENV": "production",
        "ECS_FARGATE": true,
        "DD_SITE": "us5.datadoghq.com",
        "DD_APM_ENABLED": true,
        "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT": "0.0.0.0:4317",
        "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT": "0.0.0.0:4318"
      },
      "ports": [4317, 4318]
    }
  ]
}

Note: The DataDog agent requires 256MB of memory to run, make sure you configure your instance with enough memory for both your application and the DataDog agent. It is recommended to use the DataDog agent with an instance size of minimum 1GB of memory.