Search code examples
aws-lambdamicroservicesaws-api-gatewayspring-cloud-gatewayspring-cloud-function

Amazon API Gateway and Spring cloud gateway use case


I am working on a distributed application project where there is need for rate limiting and authentication depending on the client consuming the service on an api gateway. I am wondering the best solution for designing the gateway.

Should I go with Spring cloud gateway or Spring Cloud function/AWS Lambda to create the gateway service?


Solution

  • I'd argue that using AWS API Gateway will make your life easier...

    The benefits of using AWS API Gateway are:

    • it will remove all the operational cost of maintaining, configuring, monitoring and operating a Spring Cloud Gateway instance,
    • it will be highly available, with failover,
    • it will give you instant features like rate limiting, api keys, caching, authorization, canary testing, proxying, integration mapping, environments
    • it is very very cheap ($3.50 x MM requests).

    The benefits of using Spring Cloud Function:

    • Define your API's as code within the application code itself
    • Leverage the ecosystem integration within Spring, for example, to run it locally on a dev's PC.

    Cons of using API Gateway:

    • Deployment of new API's will be harder than using Spring Cloud Gateway (you need to configure each new resource/method)
    • Your costs are now tied to the number of requests... if you have a 900.000.000 millons/months API it could get expensive
    • Vendor lock-in

    Cons of using Spring Cloud Function:

    • Operative cost of maintenance
    • Single point of failure