Scraping multiple instances of a service in ECS?

Hi. I’m trying to set up my prometheus for scraping metrics from Spring Boot app, however so far I was able to scrape only from the URL of the Load Balancer, so I never know which instance is scraped.

How do I set up the scraping to get each instance reliably?

Service is running in AWS ECS.

Looks like the solution is to use GitHub - teralytics/prometheus-ecs-discovery: A Prometheus discoverer that scrapes Amazon ECS and a generates file SD configuration file.
dockerLabels for all 4 listed labels need to be added to each container in order for the tool to detect it. The tools updates a config file, which should be reloaded by Prometheus server