15

Can't get API Gateway to work with private VPC link (behind a network load balancer to a Fargate container) containers

Hi all, I've spent the last three days trying to get this to work. My goal is to set an a POST method that redirects to a private VPC that runs a Go container.I've looked at some guides online and tried most of them. I've replicated our container to run behind a single network load balancer just for the sake of this experiment, created a VPC link and set the API method to use it, but when I tested it, all I get back is a very useless 500 internal server error. I've looked in my CloudWatch logs and am pretty sure the container is not getting hit.Any help would be great, and let me know what I need to provide so I can help.

Thanks!

This is what I get from API Gateway when testing the method:

Thu Aug 22 23:27:10 UTC 2019 : Endpoint request body after transformations: { "userId": <omitted>, ... }
Thu Aug 22 23:27:10 UTC 2019 : Sending request to http://<network load balancer DNS>:<port my code listens to>/api/someApi
Thu Aug 22 23:27:20 UTC 2019 : Execution failed due to configuration error: There was an internal error while executing your request
Thu Aug 22 23:27:20 UTC 2019 : Method completed with status: 500
Jeremy Bong
  • 431
  • 2
  • 6

1 Answers1

1

We were eventually able to get this to work. Each of the methods exposed in this API Gateway had these properties filled something like this:

  AuthorizationType
  HttpMethod
  RequestParameters:
    method.request.path.bla
  Integration:
    ConnectionType: VPC_LINK
    ConnectionId: !ImportValue bla
    RequestParameters:
      integration.request.path.bla: method.request.path.bla
    IntegrationHttpMethod: POST
    Type: HTTP_PROXY
    Uri:
      Fn::Sub:
        - http://${dnsName}/api/bla
        - dnsName:

IIRC the main thing that got this to work was specifying the connection type as VPC link

Jeremy Bong
  • 431
  • 2
  • 6