How to Dynamically Retrieve CloudWatch Log Links for an ECS Fargate Task?

I have a task that runs on ECS fargate. That task generate logs on cloudwatch when it starts running. Is there a way to make my script lookup the log link from cloudwatch for it’s own task?|

Pull the arn from the metadata endpoint. Then you should know how to call the logs.

How can I access these Task metadata endpoint information? The documentation says ${ECS_CONTAINER_METADATA_URI_V4}/task/stats. What’s that?

Checking this other doc page:

it says that the endpoint is a url, pointing to an ip… but that’s for ECS on EC2…

what about ecs fargate?

This documentation for ecs fargate ( does not mention any url.

nevermind, I was able to make it work… that’s actually already the endpoint…