By using AWS re:Post, you agree to the Terms of Use

How to configure ELB to allow outbound API calls from third-party SDKs


I have an Elastic Beanstalk application in a custom VPC running a .NET Linux instance that has a endpoint that uses a third-party SDK. The SDK needs to make a separate API call when the endpoint is hit. As an experiment, when I put the instance in a public subnet, this works. However, once I configure a Classic Load Balancer in front of the instance, I get a 504 "GATEWAY_TIMEOUT" on this endpoint. Note that all my other endpoints still work behind the Classic Load Balancer. As another experiment, I opened up all the related security groups to allow all inbound/outbound traffic from all IPs but it still did not work.

What could I be missing here?

1 Answers


Error 504 Indicates that the load balancer closed a connection because a request did not complete within the idle timeout period. You can increase the idle timeout following guideline on this document[1]

Troubleshooting steps for API Gateway Network error communicating with endpoint

Try a curl request to your backend integration endpoint using the same parameters that you expect API Gateway to pass. Confirm that the request completes and takes less than 29 seconds, which is the API Gateway Integration timeout.

Investigate Logs:

try calling the API via the Test facility in the API Gateway console and inspect the output to get more information.

Confirm that API Gateway is calling the correct endpoint and is passing the header and body values that you expect. Also, observe any error messages from calling the integration endpoint.

Sometimes the error can be caused if the backend NLB (if used) does not have Cross-Zone Load Balancing enabled and you do not have healthy resources in all AZs selected for the NLB. So, ensure that the “cross_zone.enabled” is set to “true” on the NLB. You can find this information on the ELBV2 toollinker tool → NLB → Load Balancer properties → cross_zone.enabled

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions