I don’t have enough points to comment. Just a question for @MarkB and the accepted answer. How would you do this without ecs, both via the UI and terraform.
When creating a TG with type IP (ipv4) it allows to enter static IP. I want to get around this in case of a change in IP of the ec2 receiving traffic from the TG.