Serverless frameworks, despite their name, are not really serverless. Of course, there are servers somewhere handling requests but you don’t have to worry about them. You just post a snippet of code and your hosting service takes care of the rest. But who could benefit from these new frameworks? Serdar Yegulalp over at InfoWorld takes you through five of the best uses of serverless frameworks right now.
Perhaps the most obvious use of a serverless Framework is for APIs. A RESTful API can easily be coded up and shipped to Amazon Lambda or Azure functions. The beauty of serverless frameworks is that you just need to concentrate on writing the code and deploying. Scaling the API, a common task, is taken care of. And, if the API is little used, your API server is basically free.
Next up is Webhooks. The advantages of going serverless for webhooks are similar to those for APIs: low overhead, minimal maintenance and automatic scaling. An example use is setting up a Node.js webhook to process SMS requests with Twilio.
Another great use mentioned by Serdar is serving static content. You can store static assets like videos, images and files in S3 and guarantee low latency by integrating Cloudflare’s geolocated cache. Again, the key advantage here is scaling.
Lastly, Serdar emphasizes the potential for building event-driven apps with serverless frameworks. You can use something like AWS Lambda to create background jobs triggered by incoming messages from other services, effectively creating a kind of microservices architecture. For example, every time an image is to be uploaded to an S3 bucket, you could trigger a Function that adds metadata and tailors the image away from the Web server.
Serdar warns however that you shouldn’t try to force the use of serverless frameworks on your team just because they’re the hot new thing. If your app can’t be split up into independent components so easily, maybe going serverless is not the best idea for your project.