We have a lot of code in our code base which deals with integration to external systems. We use EC2 and one of our developers decided to rewrite the whole thing in Lambda which is at least half year work. The main reason as far as I can tell, that one of the partners is polling us and asks if there was any new event in the last 10-20 secs. Currently we serve this with EC2 and it is a constant load on our EC2 instance and it is relative expensive. I am pretty much skeptic about whether rewriting the code to lambda worth the effort.
I was wondering whether there is a solution where lambda is just another layer on top of EC2. So when we have this polling like traffic then we serve it with lambda, while other traffic is served by EC2. This way we would need maybe a few days of work to reduce the load and costs of EC2. We can decide the type of traffic based on the XML structure, so it always requires XML parsing. When certain elements are there in the XML, then we have this polling request we should serve with lambda, when other tags are there, then we have different kind of requests we should serve with EC2. Is this possible somehow?
Yes this possible.
For example, assuming a http interface, you could do this with either CloudFront, API Gateway or Application Load Balancer. Just define a route for your polling traffic and route that to your Lambda, then define a route for everything else and route that to your EC2 backend.