Fargate ECS mailhog service fails without logging / diagnostic to help understand why

54 Views Asked by At

When a Fargate task fails to start, where are the logs for it? I searched everywhere for hints as to why, but I couldn't find it. It wasn't in any of the CloudWatch logging I set up, so it's a complete mystery.

I was using the Console to set it up, and it seems like it fails to run if the "Public IP" option is de-selected. It also seems to fail if I delete and then recreate the service with the same name... but I can't be sure.

Re: the public IP address, why would it fail without that? I was hoping to use an Elastic IP address with the service somehow, but perhaps with ECS this has to be done in a more clever way than just selecting the ECS service?

Hoping someone can help point me to where I can find diagnostic details on why a Task fails to run, since the logs don't make it to CloudWatch.

Here's the task:

{
    "taskDefinitionArn": "arn:aws:ecs:us-east-2:XXX:task-definition/mailhog:2",
    "containerDefinitions": [
        {
            "name": "mailhog",
            "image": "mailhog/mailhog",
            "cpu": 0,
            "portMappings": [
                {
                    "name": "mailhog-8025-tcp",
                    "containerPort": 8025,
                    "hostPort": 8025,
                    "protocol": "tcp",
                    "appProtocol": "http"
                }
            ],
            "essential": true,
            "environment": [
                {
                    "name": "MH_PORT",
                    "value": "1025"
                },
                {
                    "name": "MH_WEB_PORT",
                    "value": "8025"
                },
                {
                    "name": "MH_API_PORT",
                    "value": "8025"
                },
                {
                    "name": "MH_SMTP_PORT",
                    "value": "1025"
                }
            ],
            "environmentFiles": [],
            "mountPoints": [],
            "volumesFrom": [],
            "ulimits": [],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-create-group": "true",
                    "awslogs-group": "/ecs/mailhog",
                    "awslogs-region": "us-east-2",
                    "awslogs-stream-prefix": "ecs"
                },
                "secretOptions": []
            }
        }
    ],
    "family": "mailhog",
    "executionRoleArn": "arn:aws:iam::XXX:role/ecsTaskExecutionRole",
    "networkMode": "awsvpc",
    "revision": 2,
    "volumes": [],
    "status": "ACTIVE",
    "requiresAttributes": [
        {
            "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
        },
        {
            "name": "ecs.capability.execution-role-awslogs"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
        },
        {
            "name": "ecs.capability.task-eni"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
        }
    ],
    "placementConstraints": [],
    "compatibilities": [
        "EC2",
        "FARGATE"
    ],
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "cpu": "1024",
    "memory": "3072",
    "runtimePlatform": {
        "cpuArchitecture": "X86_64",
        "operatingSystemFamily": "LINUX"
    },
    "registeredAt": "2024-01-16T23:52:20.163Z",
    "registeredBy": "arn:aws:iam::XXX:user/gregory.johnson"
}
0

There are 0 best solutions below