Skip to content

Instantly share code, notes, and snippets.

@kennyjwilli
Created December 11, 2018 02:08
Show Gist options
  • Save kennyjwilli/21bb7e92b0b88fe479a110f956fe8e15 to your computer and use it in GitHub Desktop.
Save kennyjwilli/21bb7e92b0b88fe479a110f956fe8e15 to your computer and use it in GitHub Desktop.
let datadogService = new infra.x.ecs.EC2Service("datadog-daemon", {
cluster: cluster,
schedulingStrategy: "DAEMON",
// if you don't assign the service a public IP, it wont be able to access the internet
// see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html#task-networking-considerations
networkConfiguration: {
assignPublicIp: true,
subnets: cluster.network.subnetIds
},
taskDefinitionArgs: {
container: {
image: "datadog/agent:latest",
cpu: 10,
memory: 256,
essential: true,
portMappings: [
{
hostPort: 8126,
containerPort: 8126,
protocol: "tcp"
}
],
mountPoints: [
{
containerPath: "/var/run/docker.sock",
sourceVolume: "docker_sock",
readOnly: true
},
{
containerPath: "/host/sys/fs/cgroup",
sourceVolume: "cgroup",
readOnly: true
},
{
containerPath: "/host/proc",
sourceVolume: "proc",
readOnly: true
}],
environment: [
{
name: "DD_API_KEY",
value: "..."
},
{
name: "DD_LOG_LEVEL",
value: "debug"
},
// this env var enabled Autodiscovery
{
name: "SD_BACKEND",
value: "docker"
},
// enables trace collection
// https://docs.datadoghq.com/integrations/amazon_ecs/?tab=nodejs#trace-collection
{
name: "DD_APM_ENABLED",
value: "true"
},
{
name: "DD_APM_NON_LOCAL_TRAFFIC",
value: "true"
}
]
},
volumes: [
{
name: "docker_sock",
hostPath: "/var/run/docker.sock"
},
{
name: "proc",
hostPath: "/proc/"
},
{
name: "cgroup",
hostPath: "/sys/fs/cgroup/"
}
],
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment