- Newest
- Most votes
- Most comments
Every task gets an unique ARN at the time of launch that can be retrieved from the ECS API or from the ECS metadata endpoint inside the container at the url: ${ECS_CONTAINER_METADATA_URI_V4}/task
. At that endpoint look for TaskARN
.
More information on the ECS Metadata endpoint and all the available parameters can be found in the documentation.
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerInstance.html if you are referencing an id for each instance, it is this: ec2InstanceId, because what you are seeing in the metadata you presented is the id of the container within this deployed instance, not the instance.
I am just answered the question https://stackoverflow.com/a/76040299/4843573
No - multiple containers can be running on the same instance, container-instance is not a unique identifier.
A unique ID is already assinged to each instance of a Task. Look at tasks in the console or use the CLi..
Execute
aws ecs list-tasks --cluster [clustername]
to see all the unqiue tasks
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 7 days ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated a year ago
can you elaborate the use case a bit ? Why you want to assign unique ID to each instance of a task ?