Serverless Infrastructures

Pedro Borges
3 min readOct 11, 2018

--

Serveless infrastructures are the solution for implementing true auto-scaling and tying your costs with how much your application is used.

The traditional path of putting software into production is to test on a development computer and then try to find a server to host your code. Sometimes it can be a server maintained by the organization itself. Where you buy all the hardware and install the software there.
What has been very popular is to hire cloud resources from companies like Amazon, Google, IBM and so on to run your code.
Normally these hired services charge by the hour that you use a specified type of cloud computer. If there is code or not running, you are charged for using the machine.

AWS EC2 pricing

The great problem with that approach is that it does not scale easily. If you have a lot of traffic only in determined periods of the day, you might have to hire a more capable machine that costs more. Most of the time, the machine will be underused.

A new trend has showed up in the last couple of years that is a step ahead of charging for a machine.
You get charged only by the execution of the code. For instance, if you have a lot of traffic during an hour of your day, it will charge elastically for that hour and not for the other ones with no requests. That approach is called Serverless.

AWS Lambdas

The product following the serverless architecture I am the most familiar with is the Lambdas Service offered by AWS.

Its pricing is based on the amount of time the code is executed on the machine.

Let’s say, for instance that you have a function that receives an image over a POST request and stores this image on AWS S3. If each call takes 1ms and in one day you have 1000 calls, then you would be charged for only 1 second of execution time. The entire rest of the day would not be put in your bill.

AWS Lambda Pricing

It is possible to perform a multitude of tasks with this tool ranging from internal code for your application to exposing a web server for your public API.

Google Cloud Function and Microsoft Azure Functions

Both Google Cloud Function and Microsoft Azure Functions follow the same philosophy of AWS Lambda and could be an alternative in case you do not use the AWS environment

Google Cloud Function
Microsoft Azure Pricing

Final Thoughts

These serverless architectures are growing beyond services like AWS Lambda. For instance, AWS recently released a database service called Aurora Serveless which scales your database so you don’t have to care about doing it yourself.

I am a big advocate of this model. It helps you tie your costs with how much your application is being used.
I do believe it is here to stay and it will expand significantly in the next years.

I would love to learn more with you.
Leave a comment below with your thoughts and also ideas on what you would want be to write about!

--

--