How do I troubleshoot 503 (service unavailable) errors from my Application Load Balancer?

3 minute read
0

I get an HTTP 503 (Service unavailable) error when using an Application Load Balancer (ALB). How can I resolve this error?

Short description

To determine if the Application Load Balancer is generating the 503 errors, do one of the following:

  • Access your CloudWatch metrics and locate a metric labeled HTTPCode_ELB_503_Count.
  • Run this CURL command. If the response contains "503 Service Temporarily Unavailable," then the error is coming from the Application Load Balancer.
    Be sure to replace MY_URL with the URL used to access the Application Load Balancer:
$ curl -IkL MY_URL
  • Check your Application Load Balancer access logs. Confirm that there is an elb_status_code = 503 in the logs. If you see 503 errors in any of these places, the error is generated by your Application Load Balancer. Use the following troubleshooting steps to resolve the error.

Resolution

Verify that the target group has registered targets

Verify using the EC2 Console

  1. Access the Amazon EC2 console.
  2. On the navigation pane, under Load Balancing, choose Target Groups.
  3. Choose the name of the target group to open its details page.
  4. Choose the Targets tab.
  5. Check to see if there are targets listed. If they are listed, then they are registered.

Verify using the AWS CLI

Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.

To verify targets using the AWS CLI, use the describe-target-health command.

Register targets

If you don't see any registered targets, register them through the console or through the AWS CLI.

Verify that the target group is associated with an Auto Scaling Group (if you're using Auto Scaling)

If your Target Group is part of an Auto Scaling Group, then confirm that the two are associated correctly. If they aren't, attach the groups.

Verify using the EC2 console:

  1. Open the Amazon EC2 console.
  2. On the navigation pane, under Auto Scaling, choose Auto Scaling Groups.
  3. Choose the Auto Scaling group that you want to verify.
  4. Under Load balancing, confirm that the Target Group of the Application Load Balancer is associated with the Auto Scaling Group.

Verify using the AWS CLI

Run the describe-auto-scaling command. Be sure to replace MY-ASG with the name of your Auto Scaling group. Replace AWS-REGION with your specific AWS Region.

$ aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name MY-ASG --region AWS-REGION

In the command output, confirm that the target group is listed under TargetGroupARNs.

Attach the target group

If the target groups aren't attached to the Auto Scaling group, associate the groups through the console or through the CLI.

Check target health

After you confirm that your targets are registered, confirm they are in a healthy state. For more information, see How do I troubleshoot and fix failing health checks for Application Load Balancers?


Related information

DeregisterTargets

AttachLoadBalancerTargetGroups

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago