Task metadata available for Amazon ECS tasks on EC2
The Amazon ECS container agent provides a method to retrieve various task metadata and
Docker stats
-
Task metadata endpoint version 4 – Provides a variety of metadata and Docker stats to containers. Can also provide network rate data. Available for Amazon ECS tasks launched on Amazon EC2 Linux instances running at least version
1.39.0
of the Amazon ECS container agent. For Amazon EC2 Windows instances that useawsvpc
network mode, the Amazon ECS container agent must be at least version1.54.0
. For more information, see Amazon ECS task metadata endpoint version 4. -
Task metadata endpoint version 3 – Provides a variety of metadata and Docker stats to containers. Available for Amazon ECS tasks launched on Amazon EC2 Linux instances running at least version
1.21.0
of the Amazon ECS container agent. For Amazon EC2 Windows instances that useawsvpc
network mode, the Amazon ECS container agent must be at least version1.54.0
. For more information, see Amazon ECS task metadata endpoint version 3. -
Task metadata endpoint version 2 – Available for Amazon ECS tasks launched on Amazon EC2 Linux instances running at least version
1.17.0
of the Amazon ECS container agent. For Amazon EC2 Windows instances that useawsvpc
network mode, the Amazon ECS container agent must be at least version1.54.0
. For more information, see Amazon ECS task metadata endpoint version 2.
If your Amazon ECS task is hosted on Amazon EC2, you can also access task host metadata using the Instance Metadata Service (IMDS) endpoint. The following command, when run from within the instance hosting the task, lists the ID of the host instance.
curl http://169.254.169.254/latest/meta-data/
instance-id
The information you can obtain from the endpoint is divided into categories such as
. For more information about the
different categories of host instance metadata you can obtain using the endpoint, see
Instance metadata
categories .instance-id