skip to Main Content

I am looking for a language / framework or a method by which I can build API / web application code such that it can run on Serverless compute’s like aws lambda and the same code runs on a dedicated compute system like lightsail or EC2.

First I thought of using Docker to do this but AWS Lambda entry point is a specific function signature which is very different than Spring Controllers. Is there a solution available currently?

So basically when I run it in lambda – it will have cold start issue, later when the app is ready or get popular I would like to move it to a EC2 instance for better performance and higher traffic load.

I want to start right in this situation so that later it can be easy to port and resolve the performance issue’s

2

Answers


  1. Chosen as BEST ANSWER

    After some correct keywords in google I finally got what I was looking for, checkout this blog and code library shared by AWS which helps you convert the request and response of the request as per the framework required http request

    Running APIs Written in Java on AWS Lambda:
    https://aws.amazon.com/blogs/opensource/java-apis-aws-lambda/

    Repo Code: https://github.com/awslabs/aws-serverless-java-container

    Thanks Ricardo for your response - will do check out Lambda Snapstart for sure and try it as well. I have not tested out this completely but it looks promising to some extent.


  2. I’d say; no this is not possible easily.

    When you are building an api that you’d want to run on lambda’s you most likely will be using an API Gateway which takes care of your routing to different lambda functions (best practice). So the moment you would me working on an api like this migrating to EC2 would be a nightmare as you would need to rebuild the whole application a more of a monolith application which could run on EC2.

    I would honestly commit to either run it on EC2/Containers or run it on Lambda, if cold start is your main issue with Lambda’s you might wanna look into Lambda Snapstart for Java or use another language like Typescript/Python.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search