The Serverless Framework - Build a Chatbot
Vaibhav Singh (~vaibhavsingh97) |
Think of wireless internet, but has the wire somewhere. Serverless architecture still has the server behind :P.
What serverless actually means that developer should focus on the code rather than thinking about the servers. As a technique, it removes most of the manel parts of an application, so you can actually spend your day coding. This means that you, developers, can quickly create apps that handle production-ready traffic. You do not have to actively manage scaling for your applications. You do not have to provision the server, or to pay for resources that are unused. The serverless movement started with the release of AWS Lambda, a Function-as-a-Service (FaaS) compute service. But serverless is much more than just FaaS
Chatbots have been around for quite a long time. But why this sudden surge and interest in chatbots now? Well, there are various reasons. Unlike the earlier days, many AI and NLP capabilities are now available as consumable services. Also, serverless technologies make chatbots easier to build and scale. The question is, how is the backend served? Would you set up a dedicated server (or a cluster of servers)? That’s costly, painful, and time-consuming! or You will deploy it to Heroku, which will eventually sleep (only happens in the free tier) if no one uses your chatbot. Imagine suddenly, traffic increased your chatbot is used by thousands of people at a time. When Heroku free tier is over, the application crashed or you exceeded memory limit. What would you do now? That’s where serverless technology can help.
Benefits of serverless
No Administration - We can deploy our code without provisioning anything beforehand, or manage anything afterward. There is no concept of a fleet, an instance, or even an operating system.
Scalability - One doesn't have to care about auto-scaling, No need to show alerts or write scripts to scale up and down. With serverless, we can handle quick bursts of traffic.
Cost - Function-as-a-service (FaaS) compute and managed services charged based on actual usage rather than pre-provisioned capacity. This means one pay the amount we use, so if we use service for 10 sec then we pay for 10 sec.
Faster Development - Now loop between having an idea and deploying to production is shortened because no one need to manage anything after deployment, smaller teams can ship more features. It's easier than ever to make your idea live.
Easy Integration With Other Services Going serverless allows a seamless integration to various other cloud services from the same provider. For example, if you are using the AWS platform for chatbots, then you can use DynamoDB for the database, write programming logic as Lambda functions, and expose them through the API Gateway.
Session key Takeaways
The main question is how to write code which is serverless compliant. This is where this session will help you. This talk will help people to move a step ahead of the traditional way of writing code as some of you had already developed chatbot, I will share how can you can write the simple chatbot in python and can take leverage of serverless to deploy and publish. I will cover
- Serverless Framework principals
- AWS Lambda, Amazon Lex and API Gateway
- How to write a chatbot in python and create a Lambda function
- How to troubleshoot in a serverless world
Basic knowledge of python and development in general.
I will soon share presentation, resources, and code soon on GitHub.
Vaibhav Singh is an undergrad final year student of BML Munjal University, Gurugram. He had worked with AWS services as a solution architect intern in Amazon and he is also open source enthusiast and contributed to many open source organization like Fossasia, coala, etc. He is now Google Summer Of Code intern with FOSSASIA. Previously, He was the finalist winner in Codeheat competition.
I write mostly in python ;). I had written various small scripts to make my life easier :)