Serverless architectures are applications that depend on custom code executed in ephemeral containers. One might think that ‘Serverless’ literally means that there are no servers involved. However, Serverless comprises of two different areas which overlap with each other.
- Applications that depend on 3rd party applications/ services to manage server side state. These types of services have been defined as ‘Backend as a Service’ (BaaS).
- Applications in which a certain amount of code is written by the application developer and deployed on stateless compute containers that are event triggered and ephemeral. These are referred to as ‘Function as a Service’ (FaaS).
This post does not intend to describe about Serverless. Rather the possibility of revolutionizing the way application development is done in small and medium enterprises. Traditionally, Serverless has been viewed to have limited capabilities. Most organizations have used it for marketing applications where click counts required to be counted. Others have used it for data processing and data warehousing applications.
However, I would like to explain a brief use case where the architecture of the application can be revolutionized.
Consider a medium scale food distributor who requires a web application to track his deliveries. The traditional way of development would require a front end application, developed using a web framework such as AngularJS or ReactJS, a server to execute the back end logic of the application, typically using Spring JPA and a database to store data.
Now let’s see how the architecture can be changed to a Serverless architecture by using a services provider such as Amazon.
It might be overwhelming at first but let’s first look at the components. The web application development can be done using ReactJS. The only requirement is to add functionality to generate rest API requests. This can be easily done using a library such as “axios“. After the application has been developed, we could deploy it using the AWS ECS service where the application would be executed as a docker container. This means that the developer does not need to worry about deploying and managing it on a server. The docker container can be deployed in a Kubernetes cluster if required so that auto scaling and high availability can be guaranteed.
For authentication purposes, AWS Cognito services can be used. This means that the developer does not need to worry about managing usernames, passwords and encryption functions. The concept pretty much aligns with BaaS where AWS provides an authentication token that can be used to access services.
Next a cloud API gateway service such as AWS API gateway can be configured with the resource paths required (eg:- The method: POST, GET etc. and the corresponding resource path). The requests would then invoke the corresponding lambda functions.
The back end functionality can be reproduced using lambda functions with AWS lambda. Data formatting and SQL queries can be included within lambda functions to achieve the required behavior. When a request is received by the API gateway, a lambda will be invoked and the data can be stored on the database / retrieved from the database as required.
The database can also be hosted using AWS RDS , making a system administrator’s life much easier. In this way, the whole architecture of the application can be developed while considering the cloud services provided by Amazon.
Benefits to an SME
This means that no longer does an organization need to worry about infrastructure management.
Also, based on the concept of Serverless, you only pay for the usage. Therefore, an organization with bursts of traffic, would benefit from this because they would not have to pay for redundant infrastructure.
Risks to an SME
Vendor locking is by far the greatest risk. If the system needs to be transferred to another cloud service provider, as of now it would be a nightmare. However, in the future, cloud service providers might make transitions more smoother.
Also, Serverless application development is a daunting task for a new developer. The learning curve is steep given the number of services and the documentation a developer has to go through.
Henceforth, still it might not be feasible for a small or medium enterprise to shift their development environment to a lambda environment. However, with the advances in technology, certain architectures can be moved into a Serverless cloud provider.