Application Load Balancer for EC2 instance with Elastic IP

0

Hello,

How would I go about setting up an Internet-facing Application Load Balancer for a server running on an EC2 instance. My main purpose for doing this it to assign a certificate requested from AWS Certificate Manager, and also create an alias record with a subdomain pointing to the ALB.

The instance has been allocated and assigned a static IP (elastic IP).

My problem is that the load balancer does not seem to be able to reach the instance through the target groups.

Health checks for the target groups keep failing, even though I can query the Elastic IP separately, and see port 443 respond with HTTP status code 200 with no problems.

Health checks failed with these codes: [302]

Is this because the EC2 instance has been assigned a static IP?

Any help is appreciated!

1개 답변
4

HTTP code 302 is a redirect - it would seem that the load balancer is reaching the instance but the web server is responding by telling the ALB to go somewhere else. For example, it could be that your health check path is / but when you access that the web server redirects to /index.html - in a browser you'd barely see this but the ALB won't follow a redirect, it expects a 200 response to show the back-end as healthy.

Also: Generally, you'd assign the instance to a target group and then point the ALB to that target group - no IP addresses required to be specific. It doesn't matter if the instance has an Elastic IP or not. Again, generally, the instance would not have an Internet-reachable IP address because only the ALB really needs to communicate with it - so only having a private IP address is totally fine.

profile pictureAWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인