Serverless Architecture in a nutshell
I had been scratching my head for the past few weeks, wondering what I should write my next post about. Should I delve more into Agile methodologies? Should I focus on tech stacks? But then I noticed that a lot of the community was starting to buzz about serverless architecture, so I thought… why not?
Reading about the latest trends reminded me about the AWS training I received a few years ago when AWS Lambda had just hit the market. At the time I was fascinated at the potential and somewhere in the back of my mind the concept of serverless architecture began to make sense but I never did take the plunge into using it for my projects.
Now that the concept has become more popular I want to have a look at a fairly simple application of serverless tech as an example:
In this example, we will take a simple static site, nothing fancy. For the purposes of this example, all the serverless architecture will be AWS consisting of S3, CloudFront, Lambda, Route53 and Certificate manager.
- An S3 bucket will be in use as an origin server to host the site, all components and assets will be stored here.
- Cloud front will utilize the S3 origin server bucket in order to provide everything we need to make the site work (CSS, Images, and if we chose to use a framework such as Rect.js then react components)
- Route 53 will be our DNS (serving up our site assets to allow fast load times regardless of location around the world)
- Lambda will handle any function calls, for example, any event-driven JS scripts.
- Certificate manager will ensure that our site is HTTPS compliant.
In this particular use case, we are creating the site to be lean and only utilize the AWS services when needed rather than having dedicated servers running all the time and costing money. Serverless architecture, to me, is designed for economy of resources. It allows scalability and removes the pressure of maintaining servers and keeping them updated with security patches or the latest server OS, it is complete Infrastructure as a Service and even in some cases Backend as a Service.
As with everything there are strengths to this approach and there are weaknesses, serverless is not for every use case but can be invaluable in the right situation.
This example is very basic but I believe shows some of the potential of serverless architecture and why it has been gaining traction in the community. I am sure we will be seeing new use cases in the near future and a growth in overall usage.