Abstract
- Datadog APM is used for Application Performance Monitoring (APM)
ECS Fargate Setup
Security: whitelist outbound traffic to Datadog Endpoints
In some deployment environment, by default all outbound traffic is denied. Here is a list of datadog endpoints you can use to whitelist the traffic. So the Datadog Agent Sidecar is able to pipe the application Trace to Datadog.
Prerequisites
The setup is around Task Definition, we need to have the following 3 components inside the task definition:
- Pipe container log to AWS Firelens
Configuration for ECS Container logging
Add the following block inside the container that we want to pipe the log to Datadog. Update the highlighted parts with your own values
- AWS Firelens - Log Router Container
Configuration for Log Router Container
AWS Firelens container functions as a Log Router. Update the highlighted parts with your own values, you can refer to Hardware Details for the
cpu
andmemory
configuration
- Datadog Agent Sidecar Container
Configuration for Datadog Agent Sidecar Container
This Datadog agent sidecar container is needed to pipe the traces collected by Datadog ddtrace to Datadog. Update the highlighted parts with your own values, here is a list of environment variables you can add to further fine tune the agent
DD_APM_ENV
overridesDD_ENV
- We can use
DD_APM_IGNORE_RESOURCE
to ignore Trace from transmitted to Datadog
This Terraform code template below can help you create a task definition with Datadog APM integration
Terraform Code Template
You can use the following Terraform code template to create the task definition with Datadog APM integrated.
DD_APM_IGNORE_RESOURCES
takes in a list of resources, but I wasn't able to pass a list object to the key-value pair environment variable. Please let me know if you find a way around it 😃