SlideShare a Scribd company logo
An introduction to AWS Lambda and the Serverless Framework
© Rowell Belen 1
About Me
Rowell Belen / Senior Platform Engineer @ Algorithmia
» LinkedIn: https://linkedin.com/in/rowellbelen
» Blog: https://www.rowellbelen.com
» GitHub: https://github.com/bytekast
» Twitter: @bytekast
» Email: rowell.belen@bytekast.com
© Rowell Belen 2
What is Serverless Computing?
Serverless Computing is a cloud computing model that allows
you to build and run applications and services without thinking
about servers. The platform takes care of everything required to
run and scale your code with high availability.
© Rowell Belen 3
The Sweet Spot
© Rowell Belen 4
But... but... aren't PaaS and Serverless the same?
© Rowell Belen 5
What is the key
difference between
PaaS and Serverless?
© Rowell Belen 6
ORCHESTRATION
&
MANAGEMENT
© Rowell Belen 7
and...
SCALING!!
© Rowell Belen 8
Unit of Scale
» Data Center: Hardware (Physical Hosting Env Abstraction)
» IaaS: Virtual Machines (Hardware Abstraction)
» Paas: Application (VM Abstraction)
» Serverless: Function (Runtime Abstraction)
© Rowell Belen 9
Wait.. wait... What about containers?
© Rowell Belen 10
What are the key
differences between
Containers and Serverless?
© Rowell Belen 11
ORCHESTRATION
&
MANAGEMENT
© Rowell Belen 12
and...
SCALING!!
© Rowell Belen 13
What is AWS Lambda?
Amazon's Serverless compute platform for stateless code
execution in response to events
© Rowell Belen 14
Other Serverless Platform Providers
» Microsoft Azure Functions
» Iron.io
» Google Cloud Functions
» IBM Open Whisk
» WebTask.io
» PubNub BLOCKS
© Rowell Belen 15
How Is AWS Lambda Used?
» Stream Data Processing
» REST Backend Services
» One-off Processes
» Background Workers
» Event Responders
© Rowell Belen 16
How are Lambda Functions Triggered?
» Event-driven (SNS, SQS, S3, API-Gateway, Amazon Echo
Skills, IoT, etc.)
» Direct Invocation (CLI, SDK, etc.)
» Scheduled Interval
© Rowell Belen 17
Supported Languages
» Node.js (Javascript)
» Python
» JVM ( Java, Scala, Groovy, Kotlin, Clojure, etc. )
» C#
» GoLang
© Rowell Belen 18
Pricing
Memory (MB) Free tier seconds per month Price per 100ms ($)
128 3,200,000 0.000000208
256 1,600,000 0.000000417
512 800,000 0.000000834
1024 400,000 0.000001667
1536 266,667 0.000002501
© Rowell Belen 19
Top Tier Pricing (1536 MB Memory)
1 Million Executions @ 1 sec/exec ≈ $18.34
© Rowell Belen 20
Benefits
» Cost and Utilization
» Fully Managed Infrastructure
» Rapid Development
» Streamlined AWS Integrations
» Pay Per Use
» Auto Scale
» Built-in Versioning
© Rowell Belen 21
Drawbacks
» Limited Language Support
» Not Suitable for Long-running Tasks
» Local Development and Debugging Challenges
» Limited Infrastructure Transparency / Less Control
» Potential Vendor Lock-in
» Cutting-edge quirks
» Concurrent Execution Limit is Shared across entire AWS
© Rowell Belen 22
Enough chit-chat,
let's see some code!
© Rowell Belen 23
Sample Function
def sendImage(Map httpEvent, Context context) {
try {
final request = new RequestContext().input(httpEvent).context(context)
final imageUrl = request.httpBody()
SqsUtil.instance.sendSQSMessage(inputQueueUrl, imageUrl)
new Response().statusCode(200).body("QUEUED: ${imageUrl}")
} catch (e) {
new Response().statusCode(500).body(e.message)
}
}
© Rowell Belen 24
What is the Serverless Framework?
Development toolkit for building, managing and deploying
Serverless applications and resources
© Rowell Belen 25
Serverless Framework CLI
npm install serverless -g
mkdir my-api && cd my-api
serverless create --template aws-groovy-gradle
serverless deploy --stage dev
serverless invoke --function my-function --log
© Rowell Belen 26
Available Templates
» aws-nodejs
» aws-python
» aws-groovy-gradle
» aws-java-maven
» aws-scala-sbt
» ...etc
© Rowell Belen 27
serverless.yml - Basic Function
service: serverless-demo
provider:
runtime: java8
timeout: 300
memorySize: 1536
package:
artifact: /build/dist/serverless-demo.zip
functions:
my-function:
handler: com.bytekast.serverless.MyLambdaFunction::handler
© Rowell Belen 28
serverless.yml - API Gateway
functions:
createUser:
handler: com.bytekast.serverless.UserService::createUser
events:
- http:
path: users/create
method: post
deleteUser:
handler: com.bytekast.serverless.UserService::deleteUser
events:
- http:
path: users/delete
method: delete
© Rowell Belen 29
serverless.yml - API Gateway (Custom Authorization)
...
events:
- http:
path: users/create
method: post
cors: true
authorizer:
arn: arn:aws:lambda:us-east-1:1234567890123:function:authorizer
identitySource: method.request.header.Authorization
identityValidationExpression: Bearer .*
© Rowell Belen 30
serverless.yml - SNS Topic Subscription
functions:
audit:
handler: com.bytekast.serverless.AuditService::audit
events:
- sns: dev-audit-topic
© Rowell Belen 31
serverless.yml - Scheduled Trigger
functions:
crawl:
handler: com.bytekast.serverless.SearchService::crawl
events:
- schedule: rate(2 hours)
- schedule: cron(0 12 * * ? *)
© Rowell Belen 32
serverless.yml - IAM Role Permissions
provider:
...
iamRoleStatements:
- Effect: "Allow"
Action:
- "sqs:*"
Resource: arn:aws:sqs:us-east-1:1234567890123:dev-serverless-demo
© Rowell Belen 33
serverless.yml - Create AWS Resources
resources:
Resources:
InboundQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: ${self:provider.stage}-serverless-demo
MessageRetentionPeriod: 1209600
VisibilityTimeout: 60
© Rowell Belen 34
Sample Serverless ETL Pattern
© Rowell Belen 35
Sample Serverless Platform Architecture
© Rowell Belen 36
DEMO
Build Car Image Recognition Service using
Serverless Framework + API Gateway + AWS Lambda
Sample Project
© Rowell Belen 37
What about Cloud Scale
DevOps?
© Rowell Belen 38
Lambda Built-In Features
» Containers are ephemeral entities that are easily created and
destroyed
» Preserved history and ability to roll back a bad deployment
( revert to previous version )
» Auto-managed horizontal scaling (Scale out / Scale In)
» Automatic Load Balancing
» Zero/Minimal Downtime during deployment
© Rowell Belen 39
Environments should not be connected
or otherwise intercommunicate
© Rowell Belen 40
Solutions:
» AWS Lambda supports running functions in different VPCs
(dev, stage, prod)
» Use separate AWS accounts per Environment
© Rowell Belen 41
Promote immutable application
artifacts from the lowest environment
to the highest ( Deployment )
© Rowell Belen 42
Solutions:
» Publish Versioned Build Artifacts to Repository
» Continuous Integration
» Continuous Delivery
© Rowell Belen 43
Centralized Logging
© Rowell Belen 44
Metrics
» Better Dashboards
» Custom Metrics and Events
© Rowell Belen 45
Standardize Projects using
Templates
Custom Project Starter Kit
© Rowell Belen 46
Other Things to Consider
» AWS functions are recycled about every 5-8 hours
» Container instances idle for about 5 minutes are destroyed
» Cold starts can cause delay in response times
» 50 MB max deployment package size
» 5 minute running time limit / ~ 30 seconds if API Gateway
triggered
» 1000 default concurrent function executions across entire
AWS account
© Rowell Belen 47
Questions?
© Rowell Belen 48

More Related Content

What's hot

Getting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and ServerlessGetting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and Serverless
Amazon Web Services
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda
Apigee | Google Cloud
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
Amazon Web Services
 
Serverless
ServerlessServerless
Serverless
lakshman diwaakar
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
Elana Krasner
 
Deep Dive on AWS Lambda
Deep Dive on AWS LambdaDeep Dive on AWS Lambda
Deep Dive on AWS Lambda
Amazon Web Services
 
Elastic Load Balancing Deep Dive - AWS Online Tech Talk
Elastic  Load Balancing Deep Dive - AWS Online Tech TalkElastic  Load Balancing Deep Dive - AWS Online Tech Talk
Elastic Load Balancing Deep Dive - AWS Online Tech Talk
Amazon Web Services
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
Amazon Web Services
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
Amazon Web Services
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
Amazon Web Services
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
Muhammed YALÇIN
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)
Ashish Kushwaha
 
Getting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless ComputingGetting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless Computing
Amazon Web Services
 
Microservices Architectures on Amazon Web Services
Microservices Architectures on Amazon Web ServicesMicroservices Architectures on Amazon Web Services
Microservices Architectures on Amazon Web Services
Amazon Web Services
 
Serverless Architectures.pdf
Serverless Architectures.pdfServerless Architectures.pdf
Serverless Architectures.pdf
Amazon Web Services
 
Getting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceGetting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration Service
Amazon Web Services
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
Amazon Web Services
 
AWS Lambda Features and Uses
AWS Lambda Features and UsesAWS Lambda Features and Uses
AWS Lambda Features and Uses
GlobalLogic Ukraine
 
Getting Started with Amazon Kinesis
Getting Started with Amazon KinesisGetting Started with Amazon Kinesis
Getting Started with Amazon Kinesis
Amazon Web Services
 
Eks and fargate
Eks and fargateEks and fargate
Eks and fargate
Asaf Abres
 

What's hot (20)

Getting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and ServerlessGetting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and Serverless
 
Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Serverless
ServerlessServerless
Serverless
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
Deep Dive on AWS Lambda
Deep Dive on AWS LambdaDeep Dive on AWS Lambda
Deep Dive on AWS Lambda
 
Elastic Load Balancing Deep Dive - AWS Online Tech Talk
Elastic  Load Balancing Deep Dive - AWS Online Tech TalkElastic  Load Balancing Deep Dive - AWS Online Tech Talk
Elastic Load Balancing Deep Dive - AWS Online Tech Talk
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)
 
Getting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless ComputingGetting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless Computing
 
Microservices Architectures on Amazon Web Services
Microservices Architectures on Amazon Web ServicesMicroservices Architectures on Amazon Web Services
Microservices Architectures on Amazon Web Services
 
Serverless Architectures.pdf
Serverless Architectures.pdfServerless Architectures.pdf
Serverless Architectures.pdf
 
Getting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceGetting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration Service
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
AWS Lambda Features and Uses
AWS Lambda Features and UsesAWS Lambda Features and Uses
AWS Lambda Features and Uses
 
Getting Started with Amazon Kinesis
Getting Started with Amazon KinesisGetting Started with Amazon Kinesis
Getting Started with Amazon Kinesis
 
Eks and fargate
Eks and fargateEks and fargate
Eks and fargate
 

Similar to Serverless Framework (2018)

Microservices with AWS Lambda and the Serverless Framework
Microservices with AWS Lambda and the Serverless FrameworkMicroservices with AWS Lambda and the Serverless Framework
Microservices with AWS Lambda and the Serverless Framework
Rowell Belen
 
Practical Cloud
Practical CloudPractical Cloud
Practical Cloud
Lynn Langit
 
AWS Enterprise Workloads on AWS IP Expo 2013
AWS Enterprise Workloads on AWS IP Expo 2013AWS Enterprise Workloads on AWS IP Expo 2013
AWS Enterprise Workloads on AWS IP Expo 2013
Amazon Web Services
 
Patterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWSPatterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWS
Boyan Dimitrov
 
Čtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal HatákČtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal Haták
Ctvrtkoncz
 
Satrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWSSatrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWS
Idan Tohami
 
NWCloud Cloud Track - Best Practices for Architecting in the Cloud
NWCloud Cloud Track - Best Practices for Architecting in the CloudNWCloud Cloud Track - Best Practices for Architecting in the Cloud
NWCloud Cloud Track - Best Practices for Architecting in the Cloud
nwcloud
 
Zero to Serverless in 60s - Anywhere
Zero to Serverless in 60s - AnywhereZero to Serverless in 60s - Anywhere
Zero to Serverless in 60s - Anywhere
Brian Christner
 
Building scalable OTT workflows on AWS - Serverless Video Workflows
Building scalable OTT workflows on AWS - Serverless Video WorkflowsBuilding scalable OTT workflows on AWS - Serverless Video Workflows
Building scalable OTT workflows on AWS - Serverless Video Workflows
Amazon Web Services
 
A1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloud
A1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloudA1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloud
A1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloud
Dr. Wilfred Lin (Ph.D.)
 
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
Amazon Web Services
 
Mainframe to Serverless Architectures
Mainframe to Serverless ArchitecturesMainframe to Serverless Architectures
Mainframe to Serverless Architectures
Maksim Djackov
 
Introducing to serverless computing and AWS lambda - Israel Clouds Meetup
Introducing to serverless computing and AWS lambda - Israel Clouds MeetupIntroducing to serverless computing and AWS lambda - Israel Clouds Meetup
Introducing to serverless computing and AWS lambda - Israel Clouds Meetup
Boaz Ziniman
 
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
Docker, Inc.
 
Databases in the Cloud - DevDay Austin 2017 Day 2
Databases in the Cloud - DevDay Austin 2017 Day 2Databases in the Cloud - DevDay Austin 2017 Day 2
Databases in the Cloud - DevDay Austin 2017 Day 2
Amazon Web Services
 
Serverless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBMServerless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBM
RightScale
 
AWS Customer Presentation - How TubeMogul uses AWS
AWS Customer Presentation - How TubeMogul uses AWSAWS Customer Presentation - How TubeMogul uses AWS
AWS Customer Presentation - How TubeMogul uses AWS
Amazon Web Services
 
Serverless Streaming Architectures and Algorithms for the Enterprise
Serverless Streaming Architectures and Algorithms for the EnterpriseServerless Streaming Architectures and Algorithms for the Enterprise
Serverless Streaming Architectures and Algorithms for the Enterprise
Arun Kejariwal
 
AWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley Wood
AWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley WoodAWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley Wood
AWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley Wood
Amazon Web Services
 
Microservices and serverless for MegaStartups - DLD TLV 2017
Microservices and serverless for MegaStartups - DLD TLV 2017Microservices and serverless for MegaStartups - DLD TLV 2017
Microservices and serverless for MegaStartups - DLD TLV 2017
Boaz Ziniman
 

Similar to Serverless Framework (2018) (20)

Microservices with AWS Lambda and the Serverless Framework
Microservices with AWS Lambda and the Serverless FrameworkMicroservices with AWS Lambda and the Serverless Framework
Microservices with AWS Lambda and the Serverless Framework
 
Practical Cloud
Practical CloudPractical Cloud
Practical Cloud
 
AWS Enterprise Workloads on AWS IP Expo 2013
AWS Enterprise Workloads on AWS IP Expo 2013AWS Enterprise Workloads on AWS IP Expo 2013
AWS Enterprise Workloads on AWS IP Expo 2013
 
Patterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWSPatterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWS
 
Čtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal HatákČtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal Haták
 
Satrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWSSatrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWS
 
NWCloud Cloud Track - Best Practices for Architecting in the Cloud
NWCloud Cloud Track - Best Practices for Architecting in the CloudNWCloud Cloud Track - Best Practices for Architecting in the Cloud
NWCloud Cloud Track - Best Practices for Architecting in the Cloud
 
Zero to Serverless in 60s - Anywhere
Zero to Serverless in 60s - AnywhereZero to Serverless in 60s - Anywhere
Zero to Serverless in 60s - Anywhere
 
Building scalable OTT workflows on AWS - Serverless Video Workflows
Building scalable OTT workflows on AWS - Serverless Video WorkflowsBuilding scalable OTT workflows on AWS - Serverless Video Workflows
Building scalable OTT workflows on AWS - Serverless Video Workflows
 
A1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloud
A1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloudA1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloud
A1 keynote oracle_infrastructure_as_a_service_move_any_workload_to_the_cloud
 
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
 
Mainframe to Serverless Architectures
Mainframe to Serverless ArchitecturesMainframe to Serverless Architectures
Mainframe to Serverless Architectures
 
Introducing to serverless computing and AWS lambda - Israel Clouds Meetup
Introducing to serverless computing and AWS lambda - Israel Clouds MeetupIntroducing to serverless computing and AWS lambda - Israel Clouds Meetup
Introducing to serverless computing and AWS lambda - Israel Clouds Meetup
 
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
 
Databases in the Cloud - DevDay Austin 2017 Day 2
Databases in the Cloud - DevDay Austin 2017 Day 2Databases in the Cloud - DevDay Austin 2017 Day 2
Databases in the Cloud - DevDay Austin 2017 Day 2
 
Serverless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBMServerless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBM
 
AWS Customer Presentation - How TubeMogul uses AWS
AWS Customer Presentation - How TubeMogul uses AWSAWS Customer Presentation - How TubeMogul uses AWS
AWS Customer Presentation - How TubeMogul uses AWS
 
Serverless Streaming Architectures and Algorithms for the Enterprise
Serverless Streaming Architectures and Algorithms for the EnterpriseServerless Streaming Architectures and Algorithms for the Enterprise
Serverless Streaming Architectures and Algorithms for the Enterprise
 
AWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley Wood
AWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley WoodAWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley Wood
AWS Summit 2013 | India - Web, Mobile and Social Apps on AWS, Kingsley Wood
 
Microservices and serverless for MegaStartups - DLD TLV 2017
Microservices and serverless for MegaStartups - DLD TLV 2017Microservices and serverless for MegaStartups - DLD TLV 2017
Microservices and serverless for MegaStartups - DLD TLV 2017
 

Recently uploaded

June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 

Recently uploaded (20)

June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 

Serverless Framework (2018)

  • 1. An introduction to AWS Lambda and the Serverless Framework © Rowell Belen 1
  • 2. About Me Rowell Belen / Senior Platform Engineer @ Algorithmia » LinkedIn: https://linkedin.com/in/rowellbelen » Blog: https://www.rowellbelen.com » GitHub: https://github.com/bytekast » Twitter: @bytekast » Email: rowell.belen@bytekast.com © Rowell Belen 2
  • 3. What is Serverless Computing? Serverless Computing is a cloud computing model that allows you to build and run applications and services without thinking about servers. The platform takes care of everything required to run and scale your code with high availability. © Rowell Belen 3
  • 4. The Sweet Spot © Rowell Belen 4
  • 5. But... but... aren't PaaS and Serverless the same? © Rowell Belen 5
  • 6. What is the key difference between PaaS and Serverless? © Rowell Belen 6
  • 9. Unit of Scale » Data Center: Hardware (Physical Hosting Env Abstraction) » IaaS: Virtual Machines (Hardware Abstraction) » Paas: Application (VM Abstraction) » Serverless: Function (Runtime Abstraction) © Rowell Belen 9
  • 10. Wait.. wait... What about containers? © Rowell Belen 10
  • 11. What are the key differences between Containers and Serverless? © Rowell Belen 11
  • 14. What is AWS Lambda? Amazon's Serverless compute platform for stateless code execution in response to events © Rowell Belen 14
  • 15. Other Serverless Platform Providers » Microsoft Azure Functions » Iron.io » Google Cloud Functions » IBM Open Whisk » WebTask.io » PubNub BLOCKS © Rowell Belen 15
  • 16. How Is AWS Lambda Used? » Stream Data Processing » REST Backend Services » One-off Processes » Background Workers » Event Responders © Rowell Belen 16
  • 17. How are Lambda Functions Triggered? » Event-driven (SNS, SQS, S3, API-Gateway, Amazon Echo Skills, IoT, etc.) » Direct Invocation (CLI, SDK, etc.) » Scheduled Interval © Rowell Belen 17
  • 18. Supported Languages » Node.js (Javascript) » Python » JVM ( Java, Scala, Groovy, Kotlin, Clojure, etc. ) » C# » GoLang © Rowell Belen 18
  • 19. Pricing Memory (MB) Free tier seconds per month Price per 100ms ($) 128 3,200,000 0.000000208 256 1,600,000 0.000000417 512 800,000 0.000000834 1024 400,000 0.000001667 1536 266,667 0.000002501 © Rowell Belen 19
  • 20. Top Tier Pricing (1536 MB Memory) 1 Million Executions @ 1 sec/exec ≈ $18.34 © Rowell Belen 20
  • 21. Benefits » Cost and Utilization » Fully Managed Infrastructure » Rapid Development » Streamlined AWS Integrations » Pay Per Use » Auto Scale » Built-in Versioning © Rowell Belen 21
  • 22. Drawbacks » Limited Language Support » Not Suitable for Long-running Tasks » Local Development and Debugging Challenges » Limited Infrastructure Transparency / Less Control » Potential Vendor Lock-in » Cutting-edge quirks » Concurrent Execution Limit is Shared across entire AWS © Rowell Belen 22
  • 23. Enough chit-chat, let's see some code! © Rowell Belen 23
  • 24. Sample Function def sendImage(Map httpEvent, Context context) { try { final request = new RequestContext().input(httpEvent).context(context) final imageUrl = request.httpBody() SqsUtil.instance.sendSQSMessage(inputQueueUrl, imageUrl) new Response().statusCode(200).body("QUEUED: ${imageUrl}") } catch (e) { new Response().statusCode(500).body(e.message) } } © Rowell Belen 24
  • 25. What is the Serverless Framework? Development toolkit for building, managing and deploying Serverless applications and resources © Rowell Belen 25
  • 26. Serverless Framework CLI npm install serverless -g mkdir my-api && cd my-api serverless create --template aws-groovy-gradle serverless deploy --stage dev serverless invoke --function my-function --log © Rowell Belen 26
  • 27. Available Templates » aws-nodejs » aws-python » aws-groovy-gradle » aws-java-maven » aws-scala-sbt » ...etc © Rowell Belen 27
  • 28. serverless.yml - Basic Function service: serverless-demo provider: runtime: java8 timeout: 300 memorySize: 1536 package: artifact: /build/dist/serverless-demo.zip functions: my-function: handler: com.bytekast.serverless.MyLambdaFunction::handler © Rowell Belen 28
  • 29. serverless.yml - API Gateway functions: createUser: handler: com.bytekast.serverless.UserService::createUser events: - http: path: users/create method: post deleteUser: handler: com.bytekast.serverless.UserService::deleteUser events: - http: path: users/delete method: delete © Rowell Belen 29
  • 30. serverless.yml - API Gateway (Custom Authorization) ... events: - http: path: users/create method: post cors: true authorizer: arn: arn:aws:lambda:us-east-1:1234567890123:function:authorizer identitySource: method.request.header.Authorization identityValidationExpression: Bearer .* © Rowell Belen 30
  • 31. serverless.yml - SNS Topic Subscription functions: audit: handler: com.bytekast.serverless.AuditService::audit events: - sns: dev-audit-topic © Rowell Belen 31
  • 32. serverless.yml - Scheduled Trigger functions: crawl: handler: com.bytekast.serverless.SearchService::crawl events: - schedule: rate(2 hours) - schedule: cron(0 12 * * ? *) © Rowell Belen 32
  • 33. serverless.yml - IAM Role Permissions provider: ... iamRoleStatements: - Effect: "Allow" Action: - "sqs:*" Resource: arn:aws:sqs:us-east-1:1234567890123:dev-serverless-demo © Rowell Belen 33
  • 34. serverless.yml - Create AWS Resources resources: Resources: InboundQueue: Type: "AWS::SQS::Queue" Properties: QueueName: ${self:provider.stage}-serverless-demo MessageRetentionPeriod: 1209600 VisibilityTimeout: 60 © Rowell Belen 34
  • 35. Sample Serverless ETL Pattern © Rowell Belen 35
  • 36. Sample Serverless Platform Architecture © Rowell Belen 36
  • 37. DEMO Build Car Image Recognition Service using Serverless Framework + API Gateway + AWS Lambda Sample Project © Rowell Belen 37
  • 38. What about Cloud Scale DevOps? © Rowell Belen 38
  • 39. Lambda Built-In Features » Containers are ephemeral entities that are easily created and destroyed » Preserved history and ability to roll back a bad deployment ( revert to previous version ) » Auto-managed horizontal scaling (Scale out / Scale In) » Automatic Load Balancing » Zero/Minimal Downtime during deployment © Rowell Belen 39
  • 40. Environments should not be connected or otherwise intercommunicate © Rowell Belen 40
  • 41. Solutions: » AWS Lambda supports running functions in different VPCs (dev, stage, prod) » Use separate AWS accounts per Environment © Rowell Belen 41
  • 42. Promote immutable application artifacts from the lowest environment to the highest ( Deployment ) © Rowell Belen 42
  • 43. Solutions: » Publish Versioned Build Artifacts to Repository » Continuous Integration » Continuous Delivery © Rowell Belen 43
  • 45. Metrics » Better Dashboards » Custom Metrics and Events © Rowell Belen 45
  • 46. Standardize Projects using Templates Custom Project Starter Kit © Rowell Belen 46
  • 47. Other Things to Consider » AWS functions are recycled about every 5-8 hours » Container instances idle for about 5 minutes are destroyed » Cold starts can cause delay in response times » 50 MB max deployment package size » 5 minute running time limit / ~ 30 seconds if API Gateway triggered » 1000 default concurrent function executions across entire AWS account © Rowell Belen 47