SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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 TalkAmazon Web Services
 
Azure key vault
Azure key vaultAzure key vault
Azure key vaultRahul Nath
 
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatchAmazon Web Services
 
Amazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | Edureka
Amazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | EdurekaAmazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | Edureka
Amazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | EdurekaEdureka!
 
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 ComputingAmazon Web Services
 
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트) 마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트) Amazon Web Services Korea
 
Building Serverless Microservices Using Serverless Framework on the Cloud
Building Serverless Microservices Using Serverless Framework on the CloudBuilding Serverless Microservices Using Serverless Framework on the Cloud
Building Serverless Microservices Using Serverless Framework on the CloudSrini Karlekar
 
Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017
Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017
Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Using AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure WorkloadsUsing AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure WorkloadsAmazon Web Services
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureAmazon Web Services
 
AWS S3 and GLACIER
AWS S3 and GLACIERAWS S3 and GLACIER
AWS S3 and GLACIERMahesh Raj
 
Introduction to AWS IAM
Introduction to AWS IAMIntroduction to AWS IAM
Introduction to AWS IAMKnoldus Inc.
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best PracticesAmazon Web Services
 

Was ist angesagt? (20)

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
 
Azure key vault
Azure key vaultAzure key vault
Azure key vault
 
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
(DVO315) Log, Monitor and Analyze your IT with Amazon CloudWatch
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
 
Amazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | Edureka
Amazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | EdurekaAmazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | Edureka
Amazon AWS | What is Amazon AWS | AWS Tutorial | AWS Training | Edureka
 
AWS Account Best Practices
AWS Account Best PracticesAWS Account Best Practices
AWS Account Best Practices
 
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
 
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트) 마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
 
Building Serverless Microservices Using Serverless Framework on the Cloud
Building Serverless Microservices Using Serverless Framework on the CloudBuilding Serverless Microservices Using Serverless Framework on the Cloud
Building Serverless Microservices Using Serverless Framework on the Cloud
 
Aws VPC
Aws VPCAws VPC
Aws VPC
 
Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017
Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017
Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017
 
Using AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure WorkloadsUsing AWS Key Management Service for Secure Workloads
Using AWS Key Management Service for Secure Workloads
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
 
Amazon Cognito Deep Dive
Amazon Cognito Deep DiveAmazon Cognito Deep Dive
Amazon Cognito Deep Dive
 
AWS S3 and GLACIER
AWS S3 and GLACIERAWS S3 and GLACIER
AWS S3 and GLACIER
 
AWS EC2
AWS EC2AWS EC2
AWS EC2
 
ElastiCache & Redis
ElastiCache & RedisElastiCache & Redis
ElastiCache & Redis
 
AWS Route53
AWS Route53AWS Route53
AWS Route53
 
Introduction to AWS IAM
Introduction to AWS IAMIntroduction to AWS IAM
Introduction to AWS IAM
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best Practices
 

Ähnlich wie 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 FrameworkRowell Belen
 
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 2013Amazon 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 AWSBoyan 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ákCtvrtkoncz
 
Satrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWSSatrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWSIdan 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 Cloudnwcloud
 
Zero to Serverless in 60s - Anywhere
Zero to Serverless in 60s - AnywhereZero to Serverless in 60s - Anywhere
Zero to Serverless in 60s - AnywhereBrian 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 WorkflowsAmazon 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_cloudDr. 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 CloudAmazon Web Services
 
Mainframe to Serverless Architectures
Mainframe to Serverless ArchitecturesMainframe to Serverless Architectures
Mainframe to Serverless ArchitecturesMaksim 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 MeetupBoaz 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 2Amazon 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 IBMRightScale
 
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 AWSAmazon 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 EnterpriseArun 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 WoodAmazon 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 2017Boaz Ziniman
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

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