I learn how to upload node.js server with ECS ECR. When I choose Fargate type my target group suppose to be IP address and everything work fine. When I choose EC2 type my target group suppose to be instance type but when I registered the instance to the Load balancer, the health check not working and I get 502. When i do the same for EC2 type with target group of IP address, it is working. I found out when i create the ECS service and try to select my target group at the Load balancer -> container section I cant choose target group with instance type. So I created new load balancer and it created one with IP address type. Am I wrong? IP address type is the right choice for EC2 Launch type or I forgot to do something at the process.
When I choose EC2 type my target group suppose to be instance type but when I registered the instance to the Load balancer, the health check not working and I get 502.
You would only do that if you were installing software directly on the EC2 instance yourself. For ECS, you will use IP targets.