0 votes
in AWS by

You are working on building microservices using Amazon ECS. This ECS will be deployed in an Amazon EC2 instance along with its Amazon ECS container agent.

After successfully launching the EC2 instance, the Amazon ECS container agent has registered this instance in a cluster.

What would be the status of the container instance & its corresponding agent connection when an ECS container is stopped?

1 Answer

0 votes
by

Correct Answer - B.

When an ECS container is stopped, the Container instance status remains Active, but the container Agent status changes to FALSE after a few minutes.

Option A is incorrect as when the ECS container is stopped, Agent connection status changes to False & not True.

Options C & D are incorrect as when the ECS container is stopped, the Container instance remains active & not inactive.

For more information on enabling ECS on EC2 instance, refer to the following URL-

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html

In Amazon ECS, a container instance is an Amazon EC2 instance that is running the Amazon ECS container agent and has been registered into an Amazon ECS cluster. The Amazon ECS container agent runs on each container instance within a cluster and is responsible for registering the instance with the Amazon ECS service, reporting resource utilization and status updates for running tasks, and handling task state changes.

When an ECS container is stopped, the task running within the container is terminated, and the container is removed from the container instance. The Amazon ECS container agent sends a message to the Amazon ECS service indicating that the task has stopped.

Based on this behavior, the correct answer is option B: Container instance status remains as ACTIVE and Agent connection status as FALSE after a few minutes.

The container instance status remains as ACTIVE because the EC2 instance is still running and available for other tasks to be scheduled on it. However, the agent connection status changes to FALSE because the Amazon ECS container agent is no longer able to communicate with the stopped container. After a few minutes, the Amazon ECS service updates the status of the container instance and agent connection to reflect the stopped container.

Option A is incorrect because the agent connection status changes to FALSE when a container is stopped. Option C is incorrect because the container instance does not change status to INACTIVE when a container is stopped, but rather remains as ACTIVE. Option D is incorrect because the agent connection status changes to FALSE when a container is stopped, and does not remain as TRUE.

...