What is Serverless?
Serverless uses the existing managed services available through the public cloud not just as a means to host an application but becomes an intrinsic part of the application and replaces manually configured infrastructure and sometimes even entire libraries of code with the managed services.
Contrary to what the word “Server-less” would have you think, servers still exist with Server Less! With a serverless development model, developers are able to build, deploy and run applications without having to manage servers. Once deployed, a Server Less application will respond to traffic and automatically scale up or down as needed.
What is Serverless Architecture?
A web application can be built by using a collection of managed services to provide for all parts of an application such as a service to receive incoming network requests, a compute platform that just accepts code with no maintenance to execute upon those network requests, a fully managed datastore to store and retrieve data, additional services such as object storage to store files, messaging services to allow for queues, pub/sub and streams, etc. All with 0 management overhead and pay per usage billing.
What is an example of Serverless Architecture?
A REST API is the easiest example to provide. Assuming AWS as the cloud vendor, a Serverless REST API consists of API Gateway for receiving HTTP requests, Lambda functions that receive these requests and execute upon them and DynamoDB as a data store to store and retrieve data from. There are many other use cases, all with their collection of managed services.
Joot’s Serverless Architecture
The image below shows the architecture Joot uses for image processing. All of Joot’s users are managed using Cognito. Amplify was used as the library for the web app. Lambda was used to coordinate the user authentication. When a user comes into the system, they upload an image which is saved directly into the S3. Triggers set on the image upload bucket go in and then pull that image out, resize it, do some processing and pull meta-data out and store it in DynamoDb.
3 benefits to using a Serverless Architecture
- Lower cost when factoring in the reduced need for DevOps staff to set-up and maintain infrastructure over time and the pay per usage billing meaning low traffic periods can cost $0 per hour.
- Development velocity increases drastically since it is a lot easier to put solutions together and deploy it into production
- Increased up time since the cloud manages all the services for you as well as manages better under unexpected load.
What is Serverless Architecture good for?
There are very few use cases when building applications for the web for which Serverless Architectures are not an option. It all relates to the availability and maturity of managed cloud services. A lot of organizations even apply a hybrid approach where they build as Serverless as they can and fill the gaps with other technologies.
Serverless Architecture vs Microservices
This is a false dichotomy. Microservices speaks to how to structure your application at a macro level whereas Serverless describes the interior construction of the application. A Serverless application can use Microservices principles (and is often the recommended approach) and it might not. The micro services in a Microservices architecture may all be built using Serverless, or only some or none.
If you are interested in reading more in this field, you can visit our archive.