Before 2006 when Cloud Computing was not even a thing when companies needed to build APIs to be consumed by different platforms (Web, mobile, etc) they needed to set up their own IT environments to be able to make sure their APIs could scale according to their needs. Usually, this task will require a lot of time, cost more money as your APIs scaled and needed specific skills to put it in place.

After the Spring of 2006 when Amazon launched Amazon Web Services (AWS), the world of IT and Software Development was changed forever. The introduction of Cloud Computing made the implementation of Restful APIs, Web Applications, and Mobile easier, faster and more cost-effective. In the early days of AWS, a typical Restful API might look something like the image below where you will have different EC2 instances to manage your APIs endpoints. Even though you could scale your APIs according to your needs you would still pay for the time your API’s EC2 servers were not being used. Your APIs logic is a big monolithic application where you can not scale individual endpoints per specific needs. Maintenance creates another problem since you have to be careful not to break some endpoint(s) when updating an API.

Pasted image at 2016_08_09 03_20 PM

The next iteration shown in the image below shows a microservice-based architecture where your APIs is broken down by feature, in this specific example would be Products, Payments etc. The main advantage of this architecture over the previous one is that the maintenance of your API is much easier since you can update specific endpoints without compromising other services of your API. Additionally, you can potentially scale different APIs endpoints if needed. Even though this architecture is better than the previous monolithic one, you are still paying for EC2 instances even though your API might not be used.

Pasted image at 2016_08_09 03_20 PM-1

The third architecture is what is called Serverless Microservices Architecture using AWS Lambda. The main advantage of this architecture is that you do not need to manage a server (Goodbye EC2) and you do not need to worry about scaling specific end points of your API. These are all handled by AWS, you just need to worry about implementing the logic (Either in Java, NodeJS or Python) of your Lambda function and that is it. You are also charged only for the time your Lambda function is executed! As you might guess, this is a more cost-effective solution.

Pasted image at 2016_08_09 03_21 PM

At TangoCode, we are using this Serverless Microservice Architecture in many of our projects and products and we are seeing great results that we will share in a future post.