SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Amazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for KubernetesAmazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for KubernetesAmazon Web Services
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesAmazon Web Services
 
Basics AWS Presentation
Basics AWS PresentationBasics AWS Presentation
Basics AWS PresentationShyam Kumar
 
Introduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless ApplicationsIntroduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless ApplicationsAmazon Web Services
 
Introducing AWS Elastic Beanstalk
Introducing AWS Elastic BeanstalkIntroducing AWS Elastic Beanstalk
Introducing AWS Elastic BeanstalkAmazon Web Services
 
Local Testing and Deployment Best Practices for Serverless Applications - AWS...
Local Testing and Deployment Best Practices for Serverless Applications - AWS...Local Testing and Deployment Best Practices for Serverless Applications - AWS...
Local Testing and Deployment Best Practices for Serverless Applications - AWS...Amazon Web Services
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...Amazon Web Services
 
Building .NET Microservices
Building .NET MicroservicesBuilding .NET Microservices
Building .NET MicroservicesVMware Tanzu
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleKnoldus Inc.
 
Serverless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversServerless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversAmazon Web Services
 
(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWSAmazon Web Services
 
AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...
AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...
AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...Simplilearn
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Apigee | Google Cloud
 

Tendances (20)

Amazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for KubernetesAmazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for Kubernetes
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Basics AWS Presentation
Basics AWS PresentationBasics AWS Presentation
Basics AWS Presentation
 
AWS CloudFormation Masterclass
AWS CloudFormation MasterclassAWS CloudFormation Masterclass
AWS CloudFormation Masterclass
 
Introduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless ApplicationsIntroduction to AWS Lambda and Serverless Applications
Introduction to AWS Lambda and Serverless Applications
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
 
Introducing AWS Elastic Beanstalk
Introducing AWS Elastic BeanstalkIntroducing AWS Elastic Beanstalk
Introducing AWS Elastic Beanstalk
 
Local Testing and Deployment Best Practices for Serverless Applications - AWS...
Local Testing and Deployment Best Practices for Serverless Applications - AWS...Local Testing and Deployment Best Practices for Serverless Applications - AWS...
Local Testing and Deployment Best Practices for Serverless Applications - AWS...
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
 
Building .NET Microservices
Building .NET MicroservicesBuilding .NET Microservices
Building .NET Microservices
 
Deep Dive - CI/CD on AWS
Deep Dive - CI/CD on AWSDeep Dive - CI/CD on AWS
Deep Dive - CI/CD on AWS
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Aws VPC
Aws VPCAws VPC
Aws VPC
 
Serverless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversServerless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about servers
 
(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS
 
AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...
AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...
AWS Interview Questions Part - 2 | AWS Interview Questions And Answers Part -...
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda
 

En vedette

Serverless Architecture - introduction + AWS demo
Serverless Architecture - introduction + AWS demoServerless Architecture - introduction + AWS demo
Serverless Architecture - introduction + AWS demoJan van Zoggel
 
Integrate Office365 with On-premise ERP
Integrate Office365 with On-premise ERPIntegrate Office365 with On-premise ERP
Integrate Office365 with On-premise ERPEdwin Kanis
 
Aws vs. azure key parameters for decision making
Aws vs. azure   key parameters for decision makingAws vs. azure   key parameters for decision making
Aws vs. azure key parameters for decision makingAspire Systems
 
The No Stack Startup
The No Stack StartupThe No Stack Startup
The No Stack StartupAlbert Wenger
 
AWS vs AZURE : Public Cloud Comparison
AWS vs AZURE : Public Cloud ComparisonAWS vs AZURE : Public Cloud Comparison
AWS vs AZURE : Public Cloud ComparisonInApp
 
Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)Julien SIMON
 
Azure Functions VS AWS Lambda: overview and comparison
Azure Functions VS AWS Lambda: overview and comparisonAzure Functions VS AWS Lambda: overview and comparison
Azure Functions VS AWS Lambda: overview and comparisonAlex Zyl
 
Aws vs. Azure: 5 Things You Need To Know
Aws vs. Azure: 5 Things You Need To KnowAws vs. Azure: 5 Things You Need To Know
Aws vs. Azure: 5 Things You Need To KnowScalr
 
Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013
Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013
Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013Amazon Web Services
 
AWS vs Azure - Cloud Services Comparison
AWS vs Azure - Cloud Services ComparisonAWS vs Azure - Cloud Services Comparison
AWS vs Azure - Cloud Services ComparisonAniket Kanitkar
 
Azure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to KnowAzure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to KnowRightScale
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Serverless / FaaS / Lambda and how it relates to Microservices
Serverless / FaaS / Lambda and how it relates to MicroservicesServerless / FaaS / Lambda and how it relates to Microservices
Serverless / FaaS / Lambda and how it relates to MicroservicesFrank Munz
 
Writing your life
Writing your lifeWriting your life
Writing your lifeguest162a9c
 
Programaci n orientada_a_objetos_usando_java_41_to_80
Programaci n orientada_a_objetos_usando_java_41_to_80Programaci n orientada_a_objetos_usando_java_41_to_80
Programaci n orientada_a_objetos_usando_java_41_to_80Julian Morales Agudelo
 
Dogs and people
Dogs and peopleDogs and people
Dogs and peoplebymafe
 

En vedette (20)

Serverless Architecture - introduction + AWS demo
Serverless Architecture - introduction + AWS demoServerless Architecture - introduction + AWS demo
Serverless Architecture - introduction + AWS demo
 
Integrate Office365 with On-premise ERP
Integrate Office365 with On-premise ERPIntegrate Office365 with On-premise ERP
Integrate Office365 with On-premise ERP
 
Aws vs. azure key parameters for decision making
Aws vs. azure   key parameters for decision makingAws vs. azure   key parameters for decision making
Aws vs. azure key parameters for decision making
 
The No Stack Startup
The No Stack StartupThe No Stack Startup
The No Stack Startup
 
AWS vs AZURE : Public Cloud Comparison
AWS vs AZURE : Public Cloud ComparisonAWS vs AZURE : Public Cloud Comparison
AWS vs AZURE : Public Cloud Comparison
 
Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)
 
Intro to Serverless
Intro to ServerlessIntro to Serverless
Intro to Serverless
 
Azure Functions VS AWS Lambda: overview and comparison
Azure Functions VS AWS Lambda: overview and comparisonAzure Functions VS AWS Lambda: overview and comparison
Azure Functions VS AWS Lambda: overview and comparison
 
Aws vs. Azure: 5 Things You Need To Know
Aws vs. Azure: 5 Things You Need To KnowAws vs. Azure: 5 Things You Need To Know
Aws vs. Azure: 5 Things You Need To Know
 
Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013
Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013
Scaling on AWS for the First 10 Million Users (ARC206) | AWS re:Invent 2013
 
AWS vs Azure - Cloud Services Comparison
AWS vs Azure - Cloud Services ComparisonAWS vs Azure - Cloud Services Comparison
AWS vs Azure - Cloud Services Comparison
 
Azure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to KnowAzure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to Know
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Serverless / FaaS / Lambda and how it relates to Microservices
Serverless / FaaS / Lambda and how it relates to MicroservicesServerless / FaaS / Lambda and how it relates to Microservices
Serverless / FaaS / Lambda and how it relates to Microservices
 
Devon County Show 2012
Devon County Show 2012Devon County Show 2012
Devon County Show 2012
 
Writing your life
Writing your lifeWriting your life
Writing your life
 
Ggd
GgdGgd
Ggd
 
F004
F004F004
F004
 
Programaci n orientada_a_objetos_usando_java_41_to_80
Programaci n orientada_a_objetos_usando_java_41_to_80Programaci n orientada_a_objetos_usando_java_41_to_80
Programaci n orientada_a_objetos_usando_java_41_to_80
 
Dogs and people
Dogs and peopleDogs and people
Dogs and people
 

Similaire à Function as a Service

Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventJohn Schneider
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Amazon Web Services
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notesPerrin Harkins
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to KubernetesPaul Czarkowski
 
Is Serverless The New Swiss Cheese? - AWS Seattle User Group
Is Serverless The New Swiss Cheese? - AWS Seattle User GroupIs Serverless The New Swiss Cheese? - AWS Seattle User Group
Is Serverless The New Swiss Cheese? - AWS Seattle User GroupChase Douglas
 
Serverless cecilia.cho
Serverless   cecilia.choServerless   cecilia.cho
Serverless cecilia.choCecilia Cho
 
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...Amazon Web Services
 
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Emerson Eduardo Rodrigues Von Staffen
 
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from TechlightningFrequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from TechlightningArul ChristhuRaj Alphonse
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIAndrey Karpov
 
Spring, Functions, Serverless and You
Spring, Functions, Serverless and YouSpring, Functions, Serverless and You
Spring, Functions, Serverless and YouVMware Tanzu
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017Patrick Chanezon
 
Simplified DevOps Bliss -with OpenAI API
Simplified DevOps Bliss -with OpenAI APISimplified DevOps Bliss -with OpenAI API
Simplified DevOps Bliss -with OpenAI APIVictorSzoltysek
 
ApacheCon 2021: Apache NiFi 101- introduction and best practices
ApacheCon 2021:   Apache NiFi 101- introduction and best practicesApacheCon 2021:   Apache NiFi 101- introduction and best practices
ApacheCon 2021: Apache NiFi 101- introduction and best practicesTimothy Spann
 
Austin Web Architecture
Austin Web ArchitectureAustin Web Architecture
Austin Web Architecturejoaquincasares
 
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...Rich Lee
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapDaniel Zivkovic
 
Deploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsDeploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsEddie Lau
 

Similaire à Function as a Service (20)

sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notes
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to Kubernetes
 
Is Serverless The New Swiss Cheese? - AWS Seattle User Group
Is Serverless The New Swiss Cheese? - AWS Seattle User GroupIs Serverless The New Swiss Cheese? - AWS Seattle User Group
Is Serverless The New Swiss Cheese? - AWS Seattle User Group
 
Serverless cecilia.cho
Serverless   cecilia.choServerless   cecilia.cho
Serverless cecilia.cho
 
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
 
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
 
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from TechlightningFrequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CI
 
Spring, Functions, Serverless and You
Spring, Functions, Serverless and YouSpring, Functions, Serverless and You
Spring, Functions, Serverless and You
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017
 
Simplified DevOps Bliss -with OpenAI API
Simplified DevOps Bliss -with OpenAI APISimplified DevOps Bliss -with OpenAI API
Simplified DevOps Bliss -with OpenAI API
 
ApacheCon 2021: Apache NiFi 101- introduction and best practices
ApacheCon 2021:   Apache NiFi 101- introduction and best practicesApacheCon 2021:   Apache NiFi 101- introduction and best practices
ApacheCon 2021: Apache NiFi 101- introduction and best practices
 
Scala Matsuri 2017
Scala Matsuri 2017Scala Matsuri 2017
Scala Matsuri 2017
 
Austin Web Architecture
Austin Web ArchitectureAustin Web Architecture
Austin Web Architecture
 
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
GDG Taipei 2020 - Cloud and On-premises Applications Integration Using Event-...
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
 
Deploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsDeploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker Tools
 

Dernier

University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

Dernier (20)

University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

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