Overview

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that helps you easily deploy, manage, and scale containerized applications. With the Middleware Agent (MW Agent), you can effectively monitor your ECS containers and tasks running on ECS EC2 instances and ECS Fargate in your cloud, on-prem, and hybrid architectures.

Database Integrations and the Amazon ECS Anywhere approach are not currently supported.

Fargate Setup

Use the Middleware and AWS Fargate integration to monitor your applications without having to manage servers.

Create a Sidecar

For Each ECS Task that you want to monitor, add the following sidecar container in your task definition.

JSON
{
    "name": "mw-agent",
    "image": "ghcr.io/middleware-labs/mw-host-agent:master",
    "cpu": 256,
    "portMappings": [
        {
            "name": "8006-tcp",
            "containerPort": 8006,
            "hostPort": 8006,
            "protocol": "tcp",
            "appProtocol": "http"
        }
    ],
    "essential": true,
    "environment": [
        {
            "name": "MW_API_KEY",
            "value": "<Your Middleware API Key>"
        },
        {
            "name": "MW_TARGET",
            "value": "<Your Middleware Target Endpoint>"
        },
    ],
    "mountPoints": [],
    "volumesFrom": [],
    "logConfiguration": {
        <Setup Log Configurations as per your requirement>
    }
}

Collect Metrics

Adding the sidecar container mentioned above will automatically collect metrics data from your ECS tasks and containers. The Middleware Agent uses the AWS ECS Task Metadata Endpoint to fetch metrics data.

Collect Logs

Forward your ECS Task logs to Middleware. The mw-agent sidecar, mentioned above, must be running before proceeeding.

EC2 Setup

Container Trace and Log Collection

Begin collecting container trace and log data in your EC2 instance. The MW Agent will collect ECS container logs emitted to the stdout and stderr log stream and receive traces from your application and send to your Middleware account.

The MW Agent must be running as an app before setting up collection. If not, attempted trace collection will throw an error while connecting to the agent and logs will not be sent at all.

Modify your Application Task Definition

You can setup container trace and log monitoring by modifying your Task Definition JSON file or following the below steps in the AWS Management Console.

Troubleshooting

Need assistance or want to learn more about Middleware? Contact us at support[at]middleware.io.