1 Answer
- Newest
- Most votes
- Most comments
1
I think you are trying to do this backwards. Instead of registering random available IP addresses from the subnet, you should first create the resource you want to access via load balancer and then register IP of the resource to target group. Typically when using EC2 instances, you want to register them with instance ID (not IP) but IP would allow attaching other resources like databases and on-prem resources. See https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html

Thanks for your advice. Actually, I've just figured out that I can just leave
Targetsempty, and it works. Of course, as you've said, I first createdAWS::ECS::Serviceand setTargetGroupArninLoadBalancersas the target group that I mentioned. This way, the target IP is automatically registered.