Proposition # 1:
If the current state of some or all of your instances is OutOfService and a message is displayed in the description field that the instance has failed, at least the unhealthy threshold for the number of health checks has been sequentially, the instances have not deleted the load balancing state.
The following are problems to search for, possible causes, and steps that you can take to solve problems by following this link: Classic troubleshooting Load balancing: health check
Proposition # 2:
chrisa_pm gave some tips on this issue:
If you can confirm that your EC2 instance is available, you can remove this from your load balancer and add it back. The load balancer will recognize it in a few minutes.
Keep in mind that you need to confirm the health as it is set in your Health Check Configuration:
- For HTTP: 80 you need to specify a page that is really accessible (e.g. index.html)
- For TCP: 80, only access to TCP port 80 is required.
Proposition # 3:
qh2 makes the decision as follows:
Create a service at startup to unregister and register your instance again.
Example: awsloadbalancer file
When the isntance value is stopped, there is no load balancing. this reboot balancing
case "$1" in start) aws --region eu-west-1 elb deregister-instances-from-load-balancer --load-balancer-name test --instances i-3c339b7c aws --region eu-west-1 elb register-instances-with-load-balancer --load-balancer-name test --instances i-3c339b7c ;; stop) echo "stopping aws instances" ;; restart) echo "Restarting aws, nothing to do" ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac
create a file in /etc/init.d/ after that, register as a service.
Proposition # 4:
Kenneth Snyder also solved the problem for a specific problem with ELB.
I also had a similar problem, but I was able to fix it.
I created a security group for ELB that accepts a request for port 80 and go to EC2 on port 80. The security group that was previously created for EC2 also has inbound rules for ports 80 and RDP.
However, the instances showed up as OutOfService under the ELB. Later, I tried to add another incoming rule to the EC2 security group to allow port 80 for SG, which was created for ELB. and it worked.
I think this requires that the ELB SG be allowed in the rules created for an individual instance of SG. Hope this helps.
Link to the resource:
https://forums.aws.amazon.com/thread.jspa?messageID=733153