SlideShare a Scribd company logo
Function as a Service
Exploring slack bots with Chalice and AWS Lambda
richiverse
https://github.com/richiverse/slambda
What is a Function as a Service (FAAS)?
Function as a Service (FaaS) is a category of cloud
computing services that provides a platform allowing
customers to develop, run, and manage application
functionalities without the complexity of building and
maintaining the infrastructure typically associated with
developing and launching an app (Wikipedia)
Vendors
● AWS Lambda (node.js, java 8, python 2.7)
● Google Cloud Functions (node.js)
● Microsoft Azure Functions (JavaScript, C#, Python, PHP,
Bash, Batch, and PowerShell)
● IBM Whisk (NodeJS, Swift and arbitrary binary programs
encapsulated in Docker Containers)
Isn’t this Heroku (PaaS) all over again?
You are given very few options as to how your environment is
setup. You are given the freedom of choosing where/how
your functions get called.
Anywhere you are doing IO or responding to events or quick
running jobs (< 5 minutes) is a good candidate for using
FaaS.
No provisioning servers, no complex deployments.
...So I went with AWS Lambda
One of the few that supports Python out of the box even
though it is using python 2.7 (...not bad)
● Gateway drug to other AWS services.
● Relatively stable, inexpensive relative to newcomers.
● More binaries may be announced early December
● Supports arbitrary binary execution with certain
deployment options.
Function Options
The point and click and CLI options give a lot of options over
how lambdas are run.
● Versioning
● Alias
● 1M free calls per month
● 4GB free compute memory per month
Frameworks to ease development
I ended up using Chalice because of the slick python
integration but if my project required tight integration with a lot
of other events or required docker containers I would have
gone with Gordon.
https://github.com/awslabs/chalice
https://github.com/jorgebastida/gordon
https://github.com/anaibol/awesome-serverless#frameworks
How does Chalice work?
Chalice takes your app.py as well as any dependencies in
requirements.txt, zips them up, and deploys an AWS API
Gateway endpoint to your function.
Requirements
Need AWS credentials saved in your home directory
Virtual environment and python 2.7 environment. I used
yyuu’s pyenv for a project specific 2.7 interpreter which
doesn’t interact with my system install of python 3.5 (also
using yyuu’s pyenv tool).
I created a user with the right policies for chalice to deploy
correctly.
Building a slack bot for Stackoverflow
I’m familiar with a python tool called howdoi which enables
asking SO questions at the CLI. How do I bring this useful
tool to my company? Ask them to pip install howdoi? That’s
too much to ask in this busy world!
Why not just bring the command line to them?! ;)
Hello World!
I used Pertinent Serpent’s Magic the Gathering slackbot as a
reference example of something pretty meaty over the
traditional hello world.
Things I did differently over this reference implementation
was using credstash for KMS to encrypt and store the Slack
token for authenticating users.
http://pertinentserpent.tumblr.com/post/147568685382/deploy
ing-a-slack-bot-on-amazon-lambda-with
Building a slackbot for Stackoverflow - Imports
I used python’s standard logging module to log events to
Amazon cloudwatch to track errors and log information about
the slack user/request.
Building a slackbot for Stackoverflow - Routes
Chalice has a similar syntax to Flask (Sinatra clone in
Python) where you decorate the route to your function. Here I
am using a built-in helper for query params.
Building a slackbot for Stackoverflow - secrets
By default, you deploy to dev env. Chalice roadmap includes
deploying to multiple stages. Here I also grab the keys that
I’m going to use from credstash. I setup some additional
contextual variables for retrieval in the credstash CLI.
Building a slackbot for Stackoverflow - Response
Here I quickly greet the user to avoid the 3 second Slack
timeout. I then process their query, format the response to
look nice in slack, then modify the payload and post it back in
the channel. After this, I run chalice deploy at the command
line and my code is available to test in slack.
But wait… there’s more
Cron Jobs + Arbitrary executables
While this is actually cool enough, it doesn’t tap into all the
power of FaaS.
AWS Lambdas can run on a schedule (using cron)
AWS Lambdas can operate on arbitrary executables.
Event Driven development
In reaction to an event, such as:
● S3 Bucket events
● DynamoDB event
● SNS/Kinesis events
● IOT, Alexa, Log events
Thank You!
Questions?
https://github.com/richiverse/slambda

More Related Content

PPTX
AWS Simple Storage Service (s3)
PPTX
AWS vs Azure - Cloud Services Comparison
PPTX
Introduction to GCP presentation
PDF
Introduction to Azure
PPTX
What is AWS?
PDF
AWS 101: Introduction to AWS
PDF
AWS EC2
PDF
Efficient Cloud Resource Management - Unleashing FinOps for Azure Cost Optimi...
AWS Simple Storage Service (s3)
AWS vs Azure - Cloud Services Comparison
Introduction to GCP presentation
Introduction to Azure
What is AWS?
AWS 101: Introduction to AWS
AWS EC2
Efficient Cloud Resource Management - Unleashing FinOps for Azure Cost Optimi...

What's hot (20)

PPTX
Serverless Architecture
PPTX
Azure Tutorial For Beginners | Microsoft Azure Tutorial For Beginners | Azure...
PPTX
Introduction to Amazon Web Services (AWS)
PPTX
Azure App Service Deep Dive
ODP
Introduction to Amazon Web Services
PDF
Amazon API Gateway and AWS Lambda: Better Together
PPTX
Cloud Computing.pptx
PPTX
Microsoft azure
PPT
Rackspace Hosting Presentation
PDF
Introduction to Amazon Web Services
PPTX
Azure functions
PPTX
Cloud Computing Fundamentals
PPTX
ABCs of AWS: S3
PPTX
Azure Security and Management
PPTX
PDF
Serverless computing and Function-as-a-Service (FaaS)
PPTX
Amazon_SNS.pptx
PPTX
Introduction to Cloud Computing and AWS
PDF
API Governance
PPTX
Cloud Security
Serverless Architecture
Azure Tutorial For Beginners | Microsoft Azure Tutorial For Beginners | Azure...
Introduction to Amazon Web Services (AWS)
Azure App Service Deep Dive
Introduction to Amazon Web Services
Amazon API Gateway and AWS Lambda: Better Together
Cloud Computing.pptx
Microsoft azure
Rackspace Hosting Presentation
Introduction to Amazon Web Services
Azure functions
Cloud Computing Fundamentals
ABCs of AWS: S3
Azure Security and Management
Serverless computing and Function-as-a-Service (FaaS)
Amazon_SNS.pptx
Introduction to Cloud Computing and AWS
API Governance
Cloud Security
Ad

Viewers also liked (20)

PPTX
Serverless Architecture - introduction + AWS demo
PPTX
Integrate Office365 with On-premise ERP
PPTX
Aws vs. azure key parameters for decision making
PDF
The No Stack Startup
PDF
AWS vs AZURE : Public Cloud Comparison
PDF
Running Docker clusters on AWS (November 2016)
PDF
Intro to Serverless
PPTX
Azure Functions VS AWS Lambda: overview and comparison
PPTX
Aws vs. Azure: 5 Things You Need To Know
PDF
Azure vs AWS Best Practices: What You Need to Know
PDF
Serverless / FaaS / Lambda and how it relates to Microservices
PPT
Devon County Show 2012
PPT
Writing your life
PPT
Ggd
PPS
F004
PDF
Programaci n orientada_a_objetos_usando_java_41_to_80
PPS
Dogs and people
PPS
Μάθημα πληροφορικής
PDF
Yahoo-Neighbors Helping Each Other
ODP
Pasiva
Serverless Architecture - introduction + AWS demo
Integrate Office365 with On-premise ERP
Aws vs. azure key parameters for decision making
The No Stack Startup
AWS vs AZURE : Public Cloud Comparison
Running Docker clusters on AWS (November 2016)
Intro to Serverless
Azure Functions VS AWS Lambda: overview and comparison
Aws vs. Azure: 5 Things You Need To Know
Azure vs AWS Best Practices: What You Need to Know
Serverless / FaaS / Lambda and how it relates to Microservices
Devon County Show 2012
Writing your life
Ggd
F004
Programaci n orientada_a_objetos_usando_java_41_to_80
Dogs and people
Μάθημα πληροφορικής
Yahoo-Neighbors Helping Each Other
Pasiva
Ad

Similar to Function as a Service (20)

PDF
sveltekit-en.pdf
PDF
Continuous Deployment @ AWS Re:Invent
PDF
Care and feeding notes
PDF
A DevOps guide to Kubernetes
PDF
Is Serverless The New Swiss Cheese? - AWS Seattle User Group
PDF
Building Automated Data Pipelines with Airflow.pdf
PDF
Serverless cecilia.cho
PDF
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
PDF
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
PDF
PVS-Studio in the Clouds: Travis CI
PDF
Spring, Functions, Serverless and You
PPTX
What's New in Docker - February 2017
PDF
Simplified DevOps Bliss -with OpenAI API
PDF
ApacheCon 2021: Apache NiFi 101- introduction and best practices
PDF
Scala Matsuri 2017
PDF
Austin Web Architecture
PDF
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
PDF
AWS re:Invent 2020 Serverless Recap
PPTX
Deploying Web Apps with PaaS and Docker Tools
PPTX
PaaSing Your Code Around
sveltekit-en.pdf
Continuous Deployment @ AWS Re:Invent
Care and feeding notes
A DevOps guide to Kubernetes
Is Serverless The New Swiss Cheese? - AWS Seattle User Group
Building Automated Data Pipelines with Airflow.pdf
Serverless cecilia.cho
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
PVS-Studio in the Clouds: Travis CI
Spring, Functions, Serverless and You
What's New in Docker - February 2017
Simplified DevOps Bliss -with OpenAI API
ApacheCon 2021: Apache NiFi 101- introduction and best practices
Scala Matsuri 2017
Austin Web Architecture
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
AWS re:Invent 2020 Serverless Recap
Deploying Web Apps with PaaS and Docker Tools
PaaSing Your Code Around

Recently uploaded (20)

PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
Construction Project Organization Group 2.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
Project quality management in manufacturing
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Welding lecture in detail for understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Digital Logic Computer Design lecture notes
PPTX
UNIT 4 Total Quality Management .pptx
Structs to JSON How Go Powers REST APIs.pdf
CH1 Production IntroductoryConcepts.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Arduino robotics embedded978-1-4302-3184-4.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Construction Project Organization Group 2.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
OOP with Java - Java Introduction (Basics)
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Project quality management in manufacturing
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
Welding lecture in detail for understanding
Operating System & Kernel Study Guide-1 - converted.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Digital Logic Computer Design lecture notes
UNIT 4 Total Quality Management .pptx

Function as a Service

  • 1. Function as a Service Exploring slack bots with Chalice and AWS Lambda richiverse https://github.com/richiverse/slambda
  • 2. What is a Function as a Service (FAAS)? Function as a Service (FaaS) is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage application functionalities without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app (Wikipedia)
  • 3. Vendors ● AWS Lambda (node.js, java 8, python 2.7) ● Google Cloud Functions (node.js) ● Microsoft Azure Functions (JavaScript, C#, Python, PHP, Bash, Batch, and PowerShell) ● IBM Whisk (NodeJS, Swift and arbitrary binary programs encapsulated in Docker Containers)
  • 4. Isn’t this Heroku (PaaS) all over again? You are given very few options as to how your environment is setup. You are given the freedom of choosing where/how your functions get called. Anywhere you are doing IO or responding to events or quick running jobs (< 5 minutes) is a good candidate for using FaaS. No provisioning servers, no complex deployments.
  • 5. ...So I went with AWS Lambda One of the few that supports Python out of the box even though it is using python 2.7 (...not bad) ● Gateway drug to other AWS services. ● Relatively stable, inexpensive relative to newcomers. ● More binaries may be announced early December ● Supports arbitrary binary execution with certain deployment options.
  • 6. Function Options The point and click and CLI options give a lot of options over how lambdas are run. ● Versioning ● Alias ● 1M free calls per month ● 4GB free compute memory per month
  • 7. Frameworks to ease development I ended up using Chalice because of the slick python integration but if my project required tight integration with a lot of other events or required docker containers I would have gone with Gordon. https://github.com/awslabs/chalice https://github.com/jorgebastida/gordon https://github.com/anaibol/awesome-serverless#frameworks
  • 8. How does Chalice work? Chalice takes your app.py as well as any dependencies in requirements.txt, zips them up, and deploys an AWS API Gateway endpoint to your function.
  • 9. Requirements Need AWS credentials saved in your home directory Virtual environment and python 2.7 environment. I used yyuu’s pyenv for a project specific 2.7 interpreter which doesn’t interact with my system install of python 3.5 (also using yyuu’s pyenv tool). I created a user with the right policies for chalice to deploy correctly.
  • 10. Building a slack bot for Stackoverflow I’m familiar with a python tool called howdoi which enables asking SO questions at the CLI. How do I bring this useful tool to my company? Ask them to pip install howdoi? That’s too much to ask in this busy world! Why not just bring the command line to them?! ;)
  • 11. Hello World! I used Pertinent Serpent’s Magic the Gathering slackbot as a reference example of something pretty meaty over the traditional hello world. Things I did differently over this reference implementation was using credstash for KMS to encrypt and store the Slack token for authenticating users. http://pertinentserpent.tumblr.com/post/147568685382/deploy ing-a-slack-bot-on-amazon-lambda-with
  • 12. Building a slackbot for Stackoverflow - Imports I used python’s standard logging module to log events to Amazon cloudwatch to track errors and log information about the slack user/request.
  • 13. Building a slackbot for Stackoverflow - Routes Chalice has a similar syntax to Flask (Sinatra clone in Python) where you decorate the route to your function. Here I am using a built-in helper for query params.
  • 14. Building a slackbot for Stackoverflow - secrets By default, you deploy to dev env. Chalice roadmap includes deploying to multiple stages. Here I also grab the keys that I’m going to use from credstash. I setup some additional contextual variables for retrieval in the credstash CLI.
  • 15. Building a slackbot for Stackoverflow - Response Here I quickly greet the user to avoid the 3 second Slack timeout. I then process their query, format the response to look nice in slack, then modify the payload and post it back in the channel. After this, I run chalice deploy at the command line and my code is available to test in slack.
  • 17. Cron Jobs + Arbitrary executables While this is actually cool enough, it doesn’t tap into all the power of FaaS. AWS Lambdas can run on a schedule (using cron) AWS Lambdas can operate on arbitrary executables.
  • 18. Event Driven development In reaction to an event, such as: ● S3 Bucket events ● DynamoDB event ● SNS/Kinesis events ● IOT, Alexa, Log events