Since November 2014 when AWS introduced AWS Lambda, the term “serverless” is becoming more popular, a lot of people are talking about serverless and how to apply it to your software development.
I’ve been working with AWS for a couple of years and successfully delivered a couple of serverless projects for our customers including backend services, complex web app, microservice, data processing, event streaming. I think serverless will be one of the trends of the software development trends 2019 in relation to microservice and automation.
This article will help you understand some fundamentals of serverless and steps of how to build, test, and deploy your code automatically.
What is serverless?
Serverless computing is a cloud-computing execution model in which the cloud provider runs the server, and dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity. It can be a form of utility computing.
The suffix “less” doesn’t mean your code can run without a server. Serverless is a methodology for planning, building and deploying software that maximizes value by minimizing operation tasks such as provisioning servers, OS updates, software patches.
If you wanted to know more details about serverless, this article will help you.
Serverless use cases
So we know what is serverless, but do we know when we should use serverless? With my experiences, there are some use cases that we can use serverless:
Web applications: you can use serverless to build your static websites or even complex web apps. For example, you can use AWS S3 to host your static websites that will connect to your backend services running on API Gateway that integrate with your Lambda function.
Backends: run you can your backend services (machine to machine service, SAP APIs, or for your mobile services). With AWS you can run Lambda function using API Gateway, or integrate with your existing Application Load Balancer.
Event / Data processing
- Event streaming: serverless functions can be triggered by the public/subscribe topics, from the logs such as CloudWatch events. It gives you elastic, scalable event pipelines without the maintenance of the complicated clusters.
- Cron jobs: you can run custom scheduled jobs without having to run and maintain a server.
- Image and video manipulation: you can use serverless to things like dynamically resize images or change the video encoding.
MapReduce, Batch processes, workflow (i.e. StepFunction), ETL/ELT process.
Chatbots / IoT: you can use the Lambda functions to powering chatbot logic or voice-enabled app.
DevOps / IT automation
- Extending AWS services: you can use the Lambda function to implement your custom CloudFormation resource, Cognito triggers, etc.
- Infrastructure management (CI/CD): you can use serverless to integrate and automate the CI/CD pipelines, it allows you to ship your code incrementally, bug-free and increase your productivity. For example, we can use Lambda function to implement your approval ChatOps process, Lambda function is triggered when code pushed to source control (directly or via PRs), it sends an approval request to Slack, then send back approval response from the Slack channel back to Lambda, and then kick off/reject deployment process.
The following articles provide detailed information that helps easy to understand each scenario and steps on how to implement it:
- 4 Use Cases of Serverless Architecture
- CloudWatch events
- Resize Images on the Fly with Amazon S3, AWS Lambda, and Amazon API Gateway
- Activity Tracking with a Voice-Enabled Bot on AWS
In the next post, I will describe how to build, run and deploy your Serverless functions using popular frameworks.
Thank you for reading my article. You can get in touch with me through my Twitter handle @hoangleitvn