45

enter image description here

The system

I have an API deployed on EC2 machines on AWS. Incoming HTTPS requests are passed to an elastic load balancer. The load balancer handles the SSL, and passes the request to an Nginx server, that proxies the requests to the specific servers according to the request URL.

The pain

Nginx machines require a lot of maintenance work, especially when servers IP addresses are changed. Moreover, URL-based proxy routing really seems like a natural continuation of a load balancer. Having a sane web-based or API-based interface to control URL routing would be a tremendous boon.

The question

Is there any cloud-based routing solution that can proxy HTTP requests by URL schemas, replacing my Nginx machine?

Adam Matan
  • 12,504
  • 19
  • 54
  • 73

5 Answers5

34

You can use AWS API Gateway (documentation).

API Gateway helps developers deliver robust, secure and scalable mobile and web application backends. API Gateway allows developers to securely connect mobile and web applications to business logic hosted on AWS Lambda, APIs hosted on Amazon EC2, or other publicly addressable web services hosted inside or outside of AWS. With API Gateway, developers can create and operate APIs for their backend services without developing and maintaining infrastructure to handle authorization and access control, traffic management, monitoring and analytics, version management and software development kit (SDK) generation.

API Gateway now supports HTTP Proxy integration for pass-through resources, so you don't need to describe your payload and query params explicitly (which was required previously).

techraf
  • 4,163
  • 8
  • 27
  • 44
Edward Samuel
  • 781
  • 7
  • 9
  • Thanks! This seems to be a relatively new feature, so I'm a little less embarrassed not to have known it. http://techcrunch.com/2015/07/09/aws-announces-new-api-gateway-service/ – Adam Matan Aug 01 '15 at 07:50
  • 1
    Note that as of now, API Gateway APIs have a 29 second timeout. – Mike D Feb 25 '20 at 16:15
6

Take a look at Kong.

Besides being open-source, you can operate it using its internal RESTful API, and you can extend it with custom plugins.

Mark
  • 442
  • 5
  • 12
2

Just to add to @EdwardSamuel's answer:

Yes, the there is, and the proper AWS service for this is Application Load Balancer.

However, I'm really curious if @EdwardSamuel's answer really works because I'm also interested in using API Gateway for this purpose. I'm aware of some limitations with API Gateway (content-length limit, etc.) but I'm not sure yet whether these limitations will make it unusable to, say, reverse proxy a WordPress blog.

Hendy Irawan
  • 325
  • 3
  • 8
0

CloudFront offers the ability to configure reverse proxy functionalities

Kurru
  • 145
  • 1
  • 1
  • 8
0

I think at this point another (more economical than API Gateway) solution would be an ALB using path pattern rules. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#rule-condition-types