Create a Serverless Slackbot with AWS Lambda and Python
In this course we'll build and deploy a Serverless Slack Bot using AWS Lambda and Python. Along the way you'll learn about proper security, how lambda works, and how to deploy your service.
What You Will Learn
How to use AWS Lambda
Importance of securing your account
How to setup a Slack bot
How to deploy a serverless bot into production
Serverless Computing may sound like a scary topic, but with the rise of AWS Lambda and mature tools supporting it - it's more approachable than ever. In this newline course, we're going to learn what serverless technology is and isn't, and why it belongs in your developer toolbox. We'll see that for certain common projects - like custom chat bot creation - AWS Lambda really shines for it's simplicity, affordability, and ability to integrate with the wider AWS ecosystem.
Some developers love using serverless tech because it helps them save money, scale quickly, and deliver on reliability goals. While all of those things are possible with Lambda (especially cost savings which are common - but certainly not guaranteed), it's the development agility and reduction of operations overhead that drives my love for the service. It's a relief to be able to get right into the code, without worrying about configuring operating systems, deploying containers, or scaling clusters. Serverless on Lambda gives developers the resources needed to write, deploy, and maintain production-ready software - all without significant operational overhead.
In true newline-fashion, we'll get rolling with a practical application right away. RPG players rejoice - we're creating a fully functional, dice-rolling chat bot for Slack! While the example bot will be for Slack, the same idea can be easily adapted to create a bot for Telegram, Discord, or nearly any other chat service with a bot API.
We will be using Python 3 for this project, but it's worth noting that AWS Lambda works with other common languages and runtimes, including NodeJS, Java, ruby, go, and .NET. The basic mechanisms of creating, testing, and deploying your Lambda do not vary significantly based on your runtime choice.
By the end of this course you'll:
- Deploy a Slack Bot that runs on AWS Lambda
- Understand how to keep your AWS account secure
- Be able to deploy custom Lambda functions
- Understand serverless architecture and how it works
Create a Serverless Slack Bot with AWS Lambda and Python
In true newline-fashion, we'll get *rolling* with a practical application right away. We're creating a fully functional, dice-rolling chat bot for Slack!
Configuring Your AWS Environment
AWS Environment Setup
There's no `AWS Lambda` without `AWS`. That means we'll need a few AWS resources created and configured on the AWS side of things to develop and effectively.
Configuring Our AWS Workspace
Here, we'll configure an `AWS Workspace` or `AWS EC2 Instance` as the development environment to use for developing for AWS Lambda.
Configuring Your Local Machine
Preparing your Local Development Environment For AWS Lambda and Python Development
We can comfortably develop for AWS Lambda with python on any modern Operating System
Installing Python 3 and Pyenv on MacOS, Windows, and Linux
We will be using the AWS Lambda runtime for the latest stable version of Python 3 - `python3.7`.
Configuring the AWS CLI
The easiest way to configure our local development with our credentials is to run the command `aws configure`
Creating Hello-world Lambda
Creating Dicebot Lambda
Frequently Asked Questions
What if I need help?
You can ask us questions anytime through the community Discord channel or by sending us a message.
Build a Slack Bot in Python
Learn AWS Lambda
Deploy live serverless APIs
1 complete project