1

I have a working EC2 instance I'd like to place, along with a copy, behind an Elastic Load Balancer, but I can't get it to work.

ELB Settings:

  • Ports: ELB HTTP:80 -> EC2 HTTP:80, default VPC
  • Security groups: AWS-OpsWorks-LB-Server
  • Health Check: HTTP, 80, /
  • EC2 Instance: My working EC2 instance

Hitting the ELB directly returns a 503 error code.

Digging into the Apache logs of my EC2 instance, I see:

x.x.x.xx - - [18/Feb/2016:14:21:18 +0000] "GET / HTTP/1.1" 400 52 "-" "ELB-HealthChecker/1.0"

The ELB health check is returning 400, Bad Request, but pretty sure the "/" path is correct as I have a working Drupal instance in /var/www/html.

I don't think the problem is the security groups either, since if I use the exact same ELB, as is, and fire up a new EC2 instance as a PHP App Server via AWS OpsWorks, the ELB works fine.

I'm assuming I must be missing some package or configuration but looking over the Chef 11 recipes AWS uses to build a PHP App Server it's hard to see what I've forgotten.

Thoughts?

  • On that instance itself, what do you see if you run this command: curl -kv http://127.0.0.1/? – Castaglia Feb 18 '16 at 15:19
  • "HTTP 1.1/400 Bad Request...The provided host name is not valid for this server.". Maybe related to a Drupal 8 security mechanism outlined here – OrdinaryHuman Feb 18 '16 at 15:23
1

OK, solved this -- well, at least got it working without knowing exactly the underlying cause. Thanks to TJ Saunders for pointing me in the right direction.

For whatever reason the AWS GUI wizard did not register the instance, despite the step-by-step, browser-based creation process suggest that it did. Instead from my EC2 instance I entered:

aws elb register-instances-with-load-balancer --load-balancer-name my-elbs-name --instances my-ec2-instance-id

And then it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.