Deploy Microsoft Bot framework to AWS Lambda

Mithun Das
3 min readMay 16, 2019


I got very excited when I first saw Microsoft Bot Framework ( Microsoft has done a great job! You can deploy same bot to multiple channels such as MS Team, Slack, Facebook. But all the documents/tutorial I read recommend to deploy bot backend code to Azure. I have been working with AWS for few years but never used Azure before. So was looking for a solution to deploy the Nodejs backend to AWS lambda as I am more comfortable. I still need to create Azure account to create the bot and deploy to channels but that’s OK ( who knows in future I may migrate from AWS Lambda to Azure Function :) )

I googled but did not find a solution which just works out of the box. So I decided to poke the framework code a bit and get it deployed to lambda.

PS: If you know a better and more elegant solution, please let me know.

I used yoman builder to scaffold the bot framework following this tutorial (

The framework code comes with restify web server which does not work out of the box on AWS Lambda. But fortunately AWS released aws-serverless-express which is build on top of Express server and works with AWS Lambda. So I simply removed restify and injected aws-serverless-express & express in the framework code.

Check out the commit to find the exact code change I had to do ( )

That’s all !!!

Now you are ready to deploy this code to AWS Lambda and create AWS API Gateway to access the code over REST API. Once you deploy to AWS and get the API endpoint, simply update that to Azure Bot as below.

If you are on the same boat as me and want to give a try, I have created terraform scripts to help you create AWS resources ( Lambda, Gateway ) and deploy backend code through your terminal without even log into AWS Console.

cd terraform
terraform init
terraform apply --var-file=variables.tfvars --auto-approve

At the end the script will print API Gateway endpoint on your terminal. Copy that and update in Azure.

Find the source code here