Installing the Host Agent on Amazon Elastic Container Service (ECS)

This page describes how to install the host agent into an Elastic Container Service (ECS) cluster running on Elastic Computing (EC2) using ECS Daemon Scheduling. For Fargate on AWS ECS, refer to the Fargate monitoring documentation.

Deploy the host agent via EC2 User Data

Note: This is the preferred mechanism to deploy the host agent across your ECS on EC2 clusters.

The Launching an Amazon ECS Container Instance documentation shows how to use User Data on new EC2 instances powering your ECS on EC2 clusters. The mechanisms described in Instana's Monitor AWS EC2 instances documentation applies to this use-case as well.

Deploy the host agent via an ECS Task definition

Required fields

The following settings that are required for Java applications to be correctly monitored by Instana:

{
    "ipcMode": "host",
    "pidMode": "host",
    "privileged": true,
    "networkMode": "host",
    ...
}

Example

Below you find an example of JSON you can modify to your needs to deploy the host agent; the fields you need to modify are demarcated below with <required>:

{
    "ipcMode": "host",
    "executionRoleArn": null,
    "containerDefinitions": [
        {
            "dnsSearchDomains": null,
            "logConfiguration": {
                "logDriver": "json-file"
            },
            "entryPoint": null,
            "portMappings": [],
            "command": null,
            "linuxParameters": null,
            "environment": [
                {
                    "name": "INSTANA_AGENT_ENDPOINT",
                    "value": <required>
                },
                {
                    "name": "INSTANA_AGENT_ENDPOINT_PORT",
                    "value": <required>
                },
                {
                    "name": "INSTANA_AGENT_KEY",
                    "value": <required>
                }
            ],
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [
                {
                    "readOnly": false,
                    "containerPath": "/var/run",
                    "sourceVolume": "var_run"
                },
                {
                    "readOnly": false,
                    "containerPath": "/run",
                    "sourceVolume": "run"
                },
                {
                    "readOnly": false,
                    "containerPath": "/sys",
                    "sourceVolume": "sys"
                },
                {
                    "readOnly": false,
                    "containerPath": "/dev",
                    "sourceVolume": "dev"
                },
                {
                    "readOnly": false,
                    "containerPath": "/var/log",
                    "sourceVolume": "log"
                }
            ],
            "workingDirectory": null,
            "secrets": null,
            "dockerSecurityOptions": null,
            "memory": <required>,
            "volumesFrom": null,
            "image": <required: the image used to start your container. Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed.>,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": true,
            "name": <required: the name of a container. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.>,
            "repositoryCredentials": {
                "credentialsParameter": ""
            }
        }
    ],
    "placementConstraints": [],
    "memory": <required>,
    "taskRoleArn": "",
    "family": <required: specify a name for your task definition. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.>,
    "pidMode": "host",
    "requiresCompatibilities": [
        "EC2"
    ],
    "networkMode": "host",
    "cpu": "<Required>",
    "volumes": [
        {
            "name": "dev",
            "host": {
                "sourcePath": "/dev"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "sys",
            "host": {
                "sourcePath": "/sys"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "var_run",
            "host": {
                "sourcePath": "/var/run"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "run",
            "host": {
                "sourcePath": "/run"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "log",
            "host": {
                "sourcePath": "/var/log"
            },
            "dockerVolumeConfiguration": null
        }
    ]
}