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
Relevant content
- Accepted Answerasked 2 years ago
- asked 2 months ago
- Accepted Answerasked 10 months ago
- Accepted Answerasked 8 days ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 16 days ago
Thanks for your advice. Actually, I've just figured out that I can just leave
Targets
empty, and it works. Of course, as you've said, I first createdAWS::ECS::Service
and setTargetGroupArn
inLoadBalancers
as the target group that I mentioned. This way, the target IP is automatically registered.