It’s possible to retrieve container and task metadata. Look at docs. Notice that there are different endpoints for EC2- and Fargate-based tasks.