Moving to serverless architecture (Part1)
Welcome all to my first blog post, in this series I will try my best to cover my journey of
moving all my websites that I’ve built and currently manage to Serverless architecture.
I will explain in more details what is Serverless Architecture, how can It be any useful & share with you real examples and statistics on how much you can save.
First of all let me introduce myself, my name is Sameh Hady, Front-end architect @ Cloudwiry, which is a company, based in US that is mostly focused on Cost Optimization and helping clients move to the cloud and dramatically lower their infrastructure costs.
Working in Cloudwiry was a great plus to my career path, I was fortunate enough to learn more about AWS services, tips & tricks on how to optimize & watch my AWS spent cleverly and most important use their app to monitor my cost and get feedback & recommendations about my spend.
Long intro eh? Lets cut it here and get started.
What is Serverless Architecture?
Serverless refers to applications that significantly or fully depend on 3rd party applications / services (‘in the cloud’) to manage server-side logic and state. These are typically ‘rich client’ applications (think single page web apps, or mobile apps) that use the vast ecosystem of cloud accessible databases (like Parse, Firebase), authentication services (Auth0, AWS Cognito), etc. These types of services have been previously described as ‘(Mobile) Backend as a Service’.
For decades we have been relying on Shared hosting, VPS & Dedicated servers to host our server-side code either fully managed or managed by internal team.
While the cost vary from a personal website to a successful website with millions of daily visits they still both share one common issue, they are never paying for their actual usage and mostly paying much more for infrastructure cost, server maintenance & using bigger boxes than needed.
With Serverless Architecture and moving to the cloud you are paying for what your application actually need without any kind of compromise.
Now we understand the main issue, let me share with you my previous problems and what I’ve done to mitigate them.
I’ve been managing over 30 website, most of them are business websites. Some of them are frequently updated and some of them are not.
It was no brainer for me to use WordPress as a starting point for developing these websites, as it is very easy to be used, powerful & with great library of themes & plugins.
I started with a shared host, which was one of the worst experiences I’ve ever had due to lots of limitations and downtime, which forced me to move to a dedicated server.
Beside the fact that it took me forever to install Apache, Security patches, MYSQL, Wordpress server tweaks, PHPmyadmin etc. I had everything up and running very well after that without any issues.
Usually I keep tracking my server usage, as I’m really not interested of any kind of issues that affect my client’s websites like out of memory issues or even disk space.
From what I saw, most of the time I was not using more than 10% of the server capacity, in some occasions though with more ads and hits it can reach 60%.
This was my starting point to move to the Cloud and investigate more about the possibilities & how hard is the move.
The easiest approach I found is to move everything to EC2 instance, choose the the medium and upsize, downsize the instance when needed either manually or automated based on usage and needs.
I went with that approach & I can say I’ve saved some dollars with that move, yes It wasn’t that big saving but the idea of moving everything to the cloud and being in control of my spend and the instance type that I need was really enough for me at that point.
Previously I was paying around $100 for my dedicated server, moving to AWS t2.medium decreased the cost to around $50 which was 50% savings! Great eh?
Nah, again I am not fully utilizing my instance, most of the time it is just not doing anything & I am still paying for what it should do.
In the next part I will go in depth on my approach & how I managed to dramatically decreases my spend to $3/month for my usage :)