2
votes

Although my EC2 instance (with AIM optimized-for-ECS) has the ecs agent running but the container does not start in my EC2. To confirm that ecs-agent is running at my EC2 instance, I have checked:

  • ecs logs at /var/log/ecs/ecs-xxx-abc --> ecs agent started OK
  • 'default' cluster at ecs console also register my EC2 as ECS instance

Below are captured images for proving ECS-agents are OK with my EC2 instance.

Pic1: ecs-agent start successfully on my EC2 instance

Pic2: My EC2 instance registered successfully with cluster

Pic3: Service status is ACTIVE

Pic4: Task-definition status is ACTIVE

Pic5: ECS instance is ACTIVE

Anybody have any idea why ECS does not invoke container (nginx:latest with port mapping 80) at my EC2 instance ? (no activities observed at logs as well).

I have been scratching my head many days but the issue is still there :(

1
Is the container set up as a task or a service? If a service, are there any service events? Does the cluster show as active? Can you see ECS instances in it?Geoffrey Wiseman
@GeoffreyWiseman 1) Is the container set up as a task or a service? If a service, are there any service events? --> the container is setup as a task definition. Then a service will be responsible for running that task in a cluster 2) Does the cluster show as active? Can you see ECS instances in it? --> Yup, my cluster is up & My EC2 is registered as ECS instance in it (see my attached image)Bao Huynh
Ok, your EC2 instances is visible in ECS, I agree, that's a good start. You have a service with a task definition for your ngnix container? The service tab shows your service? What's the service status? Are there any tasks in the task tab, even stopped ones? If you click on your service, what does the events tab show?Geoffrey Wiseman
@GeoffreyWiseman: I attached new pics (pic3, pic4, pic5) to prove that my task, cluster, and ECS instance are all in ACTIVE/RUNNING state. Hope you will find some hints in those picsBao Huynh
@GeoffreyWiseman: yeah, "fargate" is the point. Thanks a lot for your support. Now, I could manage to make containers to be executed on my EC2 instance :DBao Huynh

1 Answers

0
votes

Now that there's enough information in your pictures, it has become clear that what's happening is that you've launched your task with a Fargate launch type -- your task is running, but not on your EC2 instances.

Fargate's purpose is to allow you to run containers without needing to be aware of the servers/instances at all -- you're simply running those containers on infrastructure you don't have to manage.

That means that although you have an ECS cluster with EC2 instances in it, those instances aren't being used for a Fargate task, because that's kinda the whole point of Fargate.