Apr 29
To fetch current ENI ip-address for container running on ECS fargate, you can use container metadata service described here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint.html
This can be used for example in environment value on runtime in task definition:
"Command": [
"/bin/bash",
"-c",
"export HTTP_ADDRESS=http://$(curl -s http://169.254.170.2/v2/metadata | jq -r .Containers[0].Networks[0].IPv4Addresses[0])/my/cool/api && /entrypoint.sh run"
],
Leave a Reply
You must be logged in to post a comment.