Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 1/80
USE CASES FOR SERVERLESSUSE CASES FOR SERVERLESS
TECHNOLOGIESTECHNOLOGIES...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 2/80
NICE TO MEET YOUNICE TO MEET YOU
Ruslan TolstovRuslan Tolstov
Ruby Develo...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 3/80
AGENDAAGENDA
What is serverless?
How serverless works?
Providers
AWS Lamb...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 4/80
WHAT IS SERVERLESS?WHAT IS SERVERLESS?
Serverless architecture replaces l...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 5/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
5
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 6/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
5
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 7/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
OS
5
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 8/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
OS
DB
5
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 9/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
OS
DB
Hard...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 10/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
OS
DB
Har...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 11/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
OS
DB
Har...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 12/80
TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE
Set up server
OS
DB
Har...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 13/80
MICROSERVICE ARCHITECTUREMICROSERVICE ARCHITECTURE
6
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 14/80
MICROSERVICE ARCHITECTUREMICROSERVICE ARCHITECTURE
We need DevOps
6
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 15/80
SERVERLESS ARCHITECTURESERVERLESS ARCHITECTURE
Function-as-a-Service(Faa...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 16/80
SERVERLESS ARCHITECTURESERVERLESS ARCHITECTURE
Function-as-a-Service(Faa...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 17/80
FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS)
8
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 18/80
FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS)
Function as the...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 19/80
FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS)
Function as the...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 20/80
FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS)
Function as the...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 21/80
FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS)
Function as the...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 22/80
FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS)
Function as the...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 23/80
SERVERLESS EVOLUTIONSERVERLESS EVOLUTION
9
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 24/80
HOW SERVERLESS WORKS?HOW SERVERLESS WORKS?
Functions are stateless
10
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 25/80
VENDORSVENDORS
11
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 26/80
GCP SUPPORTED LANGUAGESGCP SUPPORTED LANGUAGES
12
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 27/80
AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES
13
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 28/80
AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES
13
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 29/80
AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES
13
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 30/80
AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES
13
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 31/80
MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES
14
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 32/80
MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES
14
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 33/80
MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES
14
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 34/80
MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES
14
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 35/80
MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES
14
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 36/80
MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES
14
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 37/80
REST API EXAMPLEREST API EXAMPLE
15
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 38/80
AMAZON API GATEWAYAMAZON API GATEWAY
Amazon API Gateway is a fully manag...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 39/80
AMAZON API GATEWAYAMAZON API GATEWAY
Easy API Creation and Deployment
Su...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 40/80
ONLINE EDITOR API GATEWAYONLINE EDITOR API GATEWAY
18
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 41/80
AWS LAMBDA FUNCTIONAWS LAMBDA FUNCTION
AWS Lambda is a compute service t...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 42/80
ANATOMY OF LAMBDA FUNCTION (RUBY)ANATOMY OF LAMBDA FUNCTION (RUBY)
def h...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 43/80
ANATOMY OF LAMBDA FUNCTION (NODEJS)ANATOMY OF LAMBDA FUNCTION (NODEJS)
e...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 44/80
ONLINE EDITOR LAMBDAONLINE EDITOR LAMBDA
22
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 45/80
AWS CLI + ZIPAWS CLI + ZIP
cd lambda
zip –X –r ../index.zip *
aws lambda...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 46/80
AWS CLI + CLOUDFORMATION OR SAMAWS CLI + CLOUDFORMATION OR SAM
24
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 47/80
SERVERLESS FRAMEWORKSSERVERLESS FRAMEWORKS
25
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 48/80
SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK
26
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 49/80
SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK
Cross vendor support
26
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 50/80
SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK
Cross vendor support
Dozens of ...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 51/80
SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK
Cross vendor support
Dozens of ...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 52/80
SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK
Cross vendor support
Dozens of ...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 53/80
SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK
Cross vendor support
Dozens of ...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 54/80
SERVERLESS CONFIGSERVERLESS CONFIG
service: serverless-thumbnail
runtime...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 55/80
DEPLOYDEPLOY
serverless deploy
28
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 56/80
SERVERLESS CLISERVERLESS CLI
serverless deploy -f sendEmail
serverless i...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 57/80
SERVERLESS PLUGINSSERVERLESS PLUGINS
serverless-plugin-existing-s3
serve...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 58/80
PERMISSIONSPERMISSIONS
31
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 59/80
INVOCATION TYPESINVOCATION TYPES
Synchronous
Asynchronous
32
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 60/80
RETRY BEHAVIOURRETRY BEHAVIOUR
DLQ - Dead Letter Queue
33
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 61/80
BINARIESBINARIES
Your libraries must be for the Linux x64 platform/archi...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 62/80
STEP FUNCTIONSSTEP FUNCTIONS
35
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 63/80
CONSCONS
36
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 64/80
STATELESSSTATELESS
37
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 65/80
COLDSTART TIMECOLDSTART TIME
38
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 66/80
LAMBDA LIMITSLAMBDA LIMITS
/tmp directory storage - 512 MB
Function time...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 67/80
40
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 68/80
LAMBDA SCALINGLAMBDA SCALING
1000+1000+
41
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 69/80
VENDOR LOCKVENDOR LOCK
42
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 70/80
OPENFAASOPENFAAS
OpenFaaS® (Functions as a Service) is a framework for b...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 71/80
PRICESPRICES
44
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 72/80
FREE TIERFREE TIER
Compute Time = Invocations × Duration × RAM / 1024
45
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 73/80
PRICESPRICES
46
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 74/80
LOW COMPUTE USE CASELOW COMPUTE USE CASE
47
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 75/80
HIGH COMPUTE USE CASEHIGH COMPUTE USE CASE
48
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 76/80
3RD PARTY TOOLS3RD PARTY TOOLS
Epsagon
Thundra
Dashbird
Sentry
Rollbar
49
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 77/80
USE CASESUSE CASES
Web appliactions
IoT
Media Transformation (audio/vide...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 78/80
CONCLUSIONSCONCLUSIONS
Keep the Lambda handler lean
Avoid hardcoding, us...
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 79/80
THANKS!THANKS!
52
5/7/2019 MLSDev
localhost:8000/?print-pdfi#/ 80/80
MLSDev
QUESTIONSQUESTIONS
53
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
What to Upload to SlideShare
Next
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

0

Share

Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditation 27

Download to read offline

Speech of Ruslan Tolstov, Ruby Developer at MLSDev, at Ruby Meditation 27, Dnipro, 19.05.2019
Slideshare -
Next conference - http://www.rubymeditation.com/

During this talk, we’ll discuss serverless technologies. In particular, we will talk about popular serverless platforms like AWS Lambda, Google CF, and Microsoft AF and also dwell upon serverless frameworks for managing and deploying your functions. As well, we will touch upon the potential use cases of this new approach in your existing projects.

Announcements and conference materials https://www.fb.me/RubyMeditation
News https://twitter.com/RubyMeditation
Photos https://www.instagram.com/RubyMeditation
The stream of Ruby conferences (not just ours) https://t.me/RubyMeditation

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditation 27

  1. 1. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 1/80 USE CASES FOR SERVERLESSUSE CASES FOR SERVERLESS TECHNOLOGIESTECHNOLOGIES 1
  2. 2. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 2/80 NICE TO MEET YOUNICE TO MEET YOU Ruslan TolstovRuslan Tolstov Ruby Developer at MLSDevRuby Developer at MLSDev https://bit.ly/2Ul3L33 2
  3. 3. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 3/80 AGENDAAGENDA What is serverless? How serverless works? Providers AWS Lambda AWS API Gateway Serverless Frameworks Cons Prices Use cases 3
  4. 4. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 4/80 WHAT IS SERVERLESS?WHAT IS SERVERLESS? Serverless architecture replaces long-running virtual machines with ephemeral computeServerless architecture replaces long-running virtual machines with ephemeral compute power that comes into existence on request and disappears immediately after usepower that comes into existence on request and disappears immediately after use 4
  5. 5. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 5/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE 5
  6. 6. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 6/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server 5
  7. 7. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 7/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server OS 5
  8. 8. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 8/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server OS DB 5
  9. 9. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 9/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server OS DB Hardware updates 5
  10. 10. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 10/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server OS DB Hardware updates Soft updates 5
  11. 11. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 11/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server OS DB Hardware updates Soft updates Scaling 5
  12. 12. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 12/80 TRADITIONAL ARCHITECTURETRADITIONAL ARCHITECTURE Set up server OS DB Hardware updates Soft updates Scaling 5
  13. 13. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 13/80 MICROSERVICE ARCHITECTUREMICROSERVICE ARCHITECTURE 6
  14. 14. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 14/80 MICROSERVICE ARCHITECTUREMICROSERVICE ARCHITECTURE We need DevOps 6
  15. 15. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 15/80 SERVERLESS ARCHITECTURESERVERLESS ARCHITECTURE Function-as-a-Service(FaaS)Function-as-a-Service(FaaS) 7
  16. 16. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 16/80 SERVERLESS ARCHITECTURESERVERLESS ARCHITECTURE Function-as-a-Service(FaaS)Function-as-a-Service(FaaS) 7
  17. 17. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 17/80 FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS) 8
  18. 18. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 18/80 FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS) Function as the unit of deployment and scaling 8
  19. 19. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 19/80 FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS) Function as the unit of deployment and scaling Metrics 8
  20. 20. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 20/80 FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS) Function as the unit of deployment and scaling Metrics No machines, VMs, or containers 8
  21. 21. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 21/80 FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS) Function as the unit of deployment and scaling Metrics No machines, VMs, or containers Stateless 8
  22. 22. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 22/80 FUNCTION AS A SERVICE (FAAS)FUNCTION AS A SERVICE (FAAS) Function as the unit of deployment and scaling Metrics No machines, VMs, or containers Stateless Never pay for idle 8
  23. 23. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 23/80 SERVERLESS EVOLUTIONSERVERLESS EVOLUTION 9
  24. 24. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 24/80 HOW SERVERLESS WORKS?HOW SERVERLESS WORKS? Functions are stateless 10
  25. 25. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 25/80 VENDORSVENDORS 11
  26. 26. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 26/80 GCP SUPPORTED LANGUAGESGCP SUPPORTED LANGUAGES 12
  27. 27. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 27/80 AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES 13
  28. 28. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 28/80 AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES 13
  29. 29. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 29/80 AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES 13
  30. 30. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 30/80 AWS SUPPORTED LANGUAGESAWS SUPPORTED LANGUAGES 13
  31. 31. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 31/80 MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES 14
  32. 32. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 32/80 MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES 14
  33. 33. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 33/80 MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES 14
  34. 34. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 34/80 MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES 14
  35. 35. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 35/80 MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES 14
  36. 36. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 36/80 MS AZURE SUPPORTED LANGUAGESMS AZURE SUPPORTED LANGUAGES 14
  37. 37. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 37/80 REST API EXAMPLEREST API EXAMPLE 15
  38. 38. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 38/80 AMAZON API GATEWAYAMAZON API GATEWAY Amazon API Gateway is a fully managed service that makes it easy for developers toAmazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale.create, publish, maintain, monitor, and secure APIs at any scale. 16
  39. 39. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 39/80 AMAZON API GATEWAYAMAZON API GATEWAY Easy API Creation and Deployment Support for HTTP/REST APIs and WebSocket APIs Resiliency API Lifecycle Management Monitoring Import from swagger/postman 17
  40. 40. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 40/80 ONLINE EDITOR API GATEWAYONLINE EDITOR API GATEWAY 18
  41. 41. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 41/80 AWS LAMBDA FUNCTIONAWS LAMBDA FUNCTION AWS Lambda is a compute service that lets you run code without procisioning or managing servers AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second Lambda functions can be used to join thogether many di erent AWS services AWS Services can trigger Lambda functions 19
  42. 42. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 42/80 ANATOMY OF LAMBDA FUNCTION (RUBY)ANATOMY OF LAMBDA FUNCTION (RUBY) def handler(event:, context:) #some logic { status: 200, body: {} } end ruby2.5 20
  43. 43. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 43/80 ANATOMY OF LAMBDA FUNCTION (NODEJS)ANATOMY OF LAMBDA FUNCTION (NODEJS) exports.handler = function(event, context, callback) { //some logic callback(null, { status: 200, body: {} }) } nodejs6.10 exports.handler = async (event, context) => { //some logic return { status: 200, body: {} } } nodejs8.10 21
  44. 44. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 44/80 ONLINE EDITOR LAMBDAONLINE EDITOR LAMBDA 22
  45. 45. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 45/80 AWS CLI + ZIPAWS CLI + ZIP cd lambda zip –X –r ../index.zip * aws lambda update-function-code --function-name MyLambdaFunction --zip-file fileb://index.zip 23
  46. 46. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 46/80 AWS CLI + CLOUDFORMATION OR SAMAWS CLI + CLOUDFORMATION OR SAM 24
  47. 47. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 47/80 SERVERLESS FRAMEWORKSSERVERLESS FRAMEWORKS 25
  48. 48. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 48/80 SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK 26
  49. 49. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 49/80 SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK Cross vendor support 26
  50. 50. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 50/80 SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK Cross vendor support Dozens of plugins 26
  51. 51. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 51/80 SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK Cross vendor support Dozens of plugins YAML 26
  52. 52. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 52/80 SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK Cross vendor support Dozens of plugins YAML Invoke function localy 26
  53. 53. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 53/80 SERVERLESS FRAMEWORKSERVERLESS FRAMEWORK Cross vendor support Dozens of plugins YAML Invoke function localy MIT License 26
  54. 54. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 54/80 SERVERLESS CONFIGSERVERLESS CONFIG service: serverless-thumbnail runtime: ruby2.5 provider: name: aws timeout: 30 memorySize: 128 role: ${env:AWS_ROLE} deploymentBucket: name: ${env:DEPLOYMENT_BUCKET} iamRoleStatements: - Effect: Allow Action: - s3:putObject Resource: '*' functions: thumbnail: events: - http: get thumbnail handler: handler.thumbnail resources: Resources: NewResource: Type: AWS::S3::Bucket 27
  55. 55. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 55/80 DEPLOYDEPLOY serverless deploy 28
  56. 56. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 56/80 SERVERLESS CLISERVERLESS CLI serverless deploy -f sendEmail serverless invoke local --function sendEmail serverless logs -f sendEmail 29
  57. 57. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 57/80 SERVERLESS PLUGINSSERVERLESS PLUGINS serverless-plugin-existing-s3 serverless-dotenv-plugin serverless-secrets-plugin serverless-o ine serverless-dynamodb-local 30
  58. 58. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 58/80 PERMISSIONSPERMISSIONS 31
  59. 59. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 59/80 INVOCATION TYPESINVOCATION TYPES Synchronous Asynchronous 32
  60. 60. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 60/80 RETRY BEHAVIOURRETRY BEHAVIOUR DLQ - Dead Letter Queue 33
  61. 61. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 61/80 BINARIESBINARIES Your libraries must be for the Linux x64 platform/architecture.Your libraries must be for the Linux x64 platform/architecture. npm --arch=x64 --platform=linux or deploy with CI, docker container 34
  62. 62. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 62/80 STEP FUNCTIONSSTEP FUNCTIONS 35
  63. 63. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 63/80 CONSCONS 36
  64. 64. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 64/80 STATELESSSTATELESS 37
  65. 65. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 65/80 COLDSTART TIMECOLDSTART TIME 38
  66. 66. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 66/80 LAMBDA LIMITSLAMBDA LIMITS /tmp directory storage - 512 MB Function timeout - 900 seconds (15 minutes) Body payload size - sync 6MB, async 128KB Function memory allocation - 128 MB to 3008 MB Deployment package size - 50 MB (zipped), 250 MB (unzipped) Concurrent executions - 1000 (per account) 39
  67. 67. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 67/80 40
  68. 68. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 68/80 LAMBDA SCALINGLAMBDA SCALING 1000+1000+ 41
  69. 69. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 69/80 VENDOR LOCKVENDOR LOCK 42
  70. 70. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 70/80 OPENFAASOPENFAAS OpenFaaS® (Functions as a Service) is a framework for building Serverless functions withOpenFaaS® (Functions as a Service) is a framework for building Serverless functions with Docker and Kubernetes which has rst-class support for metrics. Any process can beDocker and Kubernetes which has rst-class support for metrics. Any process can be packaged as a function enabling you to consume a range of web events without repetitivepackaged as a function enabling you to consume a range of web events without repetitive boiler-plate coding.boiler-plate coding. 43
  71. 71. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 71/80 PRICESPRICES 44
  72. 72. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 72/80 FREE TIERFREE TIER Compute Time = Invocations × Duration × RAM / 1024 45
  73. 73. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 73/80 PRICESPRICES 46
  74. 74. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 74/80 LOW COMPUTE USE CASELOW COMPUTE USE CASE 47
  75. 75. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 75/80 HIGH COMPUTE USE CASEHIGH COMPUTE USE CASE 48
  76. 76. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 76/80 3RD PARTY TOOLS3RD PARTY TOOLS Epsagon Thundra Dashbird Sentry Rollbar 49
  77. 77. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 77/80 USE CASESUSE CASES Web appliactions IoT Media Transformation (audio/video/image) Multi-Location Media Transformation with Lambda@Edge and CloudFront Mass Emailing Real-time Data Transformation CRON Jobs with CloudWatch Chatbot Websockets 50
  78. 78. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 78/80 CONCLUSIONSCONCLUSIONS Keep the Lambda handler lean Avoid hardcoding, use enviroment variables One function, One task Watch the deployment package size, remove unused dependencies Make use of error handling mechanisme, DLQs Keep containers warm Use frameworks 51
  79. 79. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 79/80 THANKS!THANKS! 52
  80. 80. 5/7/2019 MLSDev localhost:8000/?print-pdfi#/ 80/80 MLSDev QUESTIONSQUESTIONS 53

Speech of Ruslan Tolstov, Ruby Developer at MLSDev, at Ruby Meditation 27, Dnipro, 19.05.2019 Slideshare - Next conference - http://www.rubymeditation.com/ During this talk, we’ll discuss serverless technologies. In particular, we will talk about popular serverless platforms like AWS Lambda, Google CF, and Microsoft AF and also dwell upon serverless frameworks for managing and deploying your functions. As well, we will touch upon the potential use cases of this new approach in your existing projects. Announcements and conference materials https://www.fb.me/RubyMeditation News https://twitter.com/RubyMeditation Photos https://www.instagram.com/RubyMeditation The stream of Ruby conferences (not just ours) https://t.me/RubyMeditation

Views

Total views

246

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

6

Shares

0

Comments

0

Likes

0

×