Skip to content

Support ECS Monitoring containers alongside deploy task. #22

@iBotPeaches

Description

@iBotPeaches

If you use ECS Monitoring - a sidebar monitoring container is launched alongside your containers. This means when we check for the exit code we look at the first container. We have many in a non-consistent order.

{
  "containers": [
    {
      "containerArn": "arn:aws:ecs:us-east-1:xxx:container/tg-alpha/xxx/267357fc-b146-44a0-a463-cd0e758299c1",
      "taskArn": "arn:aws:ecs:us-east-1:xxx:task/tg-alpha/xxx",
      "name": "node",
      "image": "xxx.dkr.ecr.us-east-1.amazonaws.com/node-alpha:v0.0.0-6-gcb02-A-TG-1",
      "imageDigest": "sha256:xxx",
      "runtimeId": "xxx-2982235661",
      "lastStatus": "STOPPED",
      "exitCode": 1,
      "networkBindings": [],
      "networkInterfaces": [
        {
          "attachmentId": "067c937a-83f0-47b1-a3d6-8a9849eac063",
          "privateIpv4Address": "10.0.3.145"
        }
      ],
      "healthStatus": "UNKNOWN",
      "cpu": "0"
    },
    {
      "containerArn": "arn:aws:ecs:us-east-1:xxx:container/tg-alpha/xxx/e37ca100-622b-4c2f-b5a3-c3792254a229",
      "taskArn": "arn:aws:ecs:us-east-1:xxx:task/tg-alpha/xxx",
      "name": "aws-guardduty-agent-i2erCm",
      "imageDigest": "sha256:xxx",
      "runtimeId": "xxx-2715164973",
      "lastStatus": "STOPPED",
      "exitCode": 0,
      "networkBindings": [],
      "networkInterfaces": [
        {
          "attachmentId": "067c937a-83f0-47b1-a3d6-8a9849eac063",
          "privateIpv4Address": "10.0.3.145"
        }
      ],
      "healthStatus": "UNKNOWN"
    }
  ]
}

Sometimes we check the wrong container depending on the order we get. In this sample we have the sidecar guard duty and our migration container. One failed (exit code 1), other failed gracefully (stopped - 0).

We have a few options.

  1. Introduce a command to ask for the container name to check (so we filter).
  2. Extract the container name from the prepare task image changes to reduce manual container name input.
  3. Check all containers on prepare job for zero exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions