- Más nuevo
- Más votos
- Más comentarios
Hlo,
you must follow below steps and try once,
Load Balancer Configuration: Ensure that your load balancer listeners are correctly configured. It seems you have listeners set up for both HTTP (port 80) and HTTPS (port 443), which is good. Make sure they are forwarding traffic to the correct target group. Verify that your load balancer's security group allows traffic on ports 80 and 443 from the internet. Double-check both the inbound and outbound rules. Check the health check settings for your target group. Ensure that the health check path ("/") and port (5000) match the configuration of your backend application.
Target Group Configuration:** Ensure that the target group's health checks are passing successfully. If the health status is "Unhealthy," it suggests that the health checks are failing. This could be due to misconfigured health check settings or issues with the backend application responding to health check requests. Confirm that the target group's registered instances include your EC2 instance. If the instance is not registered or if it is deregistered due to failed health checks, traffic won't be routed to it.
EC2 Instance Configuration: Verify that your EC2 instance's security group allows incoming traffic on port 5000 from the load balancer. The inbound rules should permit traffic from the security group associated with the load balancer. Ensure that your backend application is listening on port 5000. You mentioned setting server.port=5000 in your Spring Boot application, which is correct. Check the logs of your backend application running on the EC2 instance. Look for any errors or exceptions that might indicate issues with the application startup or handling incoming requests.
Logging and Monitoring: If you're not seeing logs from your EC2 instance in the S3 bucket, double-check the logging configuration. Ensure that the correct log files are being captured and that the IAM role associated with your EC2 instance has permissions to write logs to the S3 bucket. Consider enabling access logs for your load balancer as well. These logs can provide insights into the incoming requests and help diagnose issues with routing or load balancing.
Morning!
EDIT: IT WORKS NOW:)
First of all, thanks for the long and detailed reply. I've come some steps forward from yesterday, I'll update the state further down.
Load Balancer:
-Make sure they are forwarding traffic to the correct target group - Yes, they are.
-Verify that your load balancer's security group allows traffic on ports 80 and 443 from the internet. - Check. Yesterday I added outbound rules for port 80 HTTP and port 443 HTTPS (prior it was only port 5000) and now the target group to which I redirect is now healthy. And the Target instance on port 5000 is also healthy (I see this under EC2->Loadbalancer->Mybalancer->Resource map).
-Check the health check settings for your target group. Ensure that the health check path ("/") and port (5000) match the configuration of your backend application. - Check. I can see in my stdout.logs that the health check is called and the target group says healthy aswell.
----
EC2 Instance Configuration:
-Verify that your EC2 instance's security group allows incoming traffic on port 5000 from the load balancer. The inbound rules should permit traffic from the security group associated with the load balancer. Check. Inbound rules for Security Group for the instance has port 22, port 80 HTTP, port 443 HTTPS and port 5000. Under "Source" the security group associated with the load balancer is stated.
---
Logging and Monitoring: I will look deeper into this, thank you.
---
State now: So like I said, yesterday I added outbound rules for the load balancers security group. This is the only change I've done since last. Target group is now healthy aswell as the instance (according to the resource map). I can make calls to my root domain from my terminal and get 200 code.
However, I have an endpoint ("/getprice") that I need to reach which, from the terminal, gives me 503 bad gateway (it takes like 20 seconds before I get that error message back). When SSHing into my instance and doing curl http://localhost:5000/getprice I get the correct response though.
What can be the problem here? The instance can obviously call the /getprice endpoint, the load balancer can call the "/" endpoint but 503's on the /getprice endpoint. I return a simple JSON file with 3 key:value's, so the file is not large by any means.
Contenido relevante
- OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 8 meses
- OFICIAL DE AWSActualizada hace 2 años