SlideShare a Scribd company logo
Srini Karlekar – Director, Software Engineering, Capital
One.
Twitter: @skarlekar
 Serverless Architectures are those models where the applications logic provided by
the Developer is run on stateless, compute containers that are provisioned and
managed by a provider.
 Typically these compute instances are ephemeral (short-lived for the duration of
the request-response cycle), typically runs a function and triggered through an
event.
 Due to the on-demand provisioning nature of this architecture, the systems built
using Serverless technologies are inherently scalable and highly responsive under
load.
2
 The introduction of function PaaS1 (fPaaS) as Lambda by Amazon in re:Invent,
Nov 2014 (and out of beta in late 2015) created a momentum for "serverless"
platform architecture. AWS Lambda was soon followed by most major cloud
platform vendors, including IBM, Microsoft, Google and, more recently, Oracle.
Serverless is a cloud-native platform model.
 Per Gartner, by 2022 most cloud architectures will evolve to a fundamentally
serverless model rendering the cloud platform architectures dominating in 2017
as legacy architectures2.
 Serverless is a cloud-native platform model and reflects the core-promise of cloud-
computing by offering agility and capability on demand at a value price.
3
1. Platform as a Service.
2. The Key Trends in PaaS, 2017 - Published: 31 January 2017 ID: G00313016
 Serverless computing model is an emerging trend and quite often misunderstood
because of the hype and build-up surrounding the topic.
 The term Serverless refers to building applications without having to configure or
maintain infrastructure required for running your applications on the cloud.
 In reality, servers are still involved, though they are owned and controlled by the
platform providers.
 On the other hand there are frameworks used for exploiting the serverless
architecture uninspiringly named Serverless Framework increasing the confusion.
4
5
 FaaS - The technique of building applications
using Serverless architecture.
 Cost Efficiency – Pay per execution model is most
efficient at managing costs.
 Ephemeral – Short-lived process triggered via
event.
 Auto-scaling – Compute resources are provisioned
granularly per request.
 Event-driven – Functions respond to events such
as http, file drop, alerts, timer, topics etc
 Microservices – Modules built to satisfy a specific
goal and uses a simple, well-defined interface.
6
 State - Due to the ephemeral nature of the FaaS architecture, the state of
your application should be managed externally from the FaaS
infrastructure or off-loaded to a cache or data-base.
 Duration - Because of the on-demand provisioning and low-cost nature of
the FaaS solution there is a restriction on how long your functions are
allowed to run. To keep the price low - as you are billed by minutes of
usage, some providers such as Amazon AWS and Microsoft Azure restrict
the duration of time a function is allowed to process a request.
7
 Deployment & Resource Limits - Some providers such as AWS
have deployment limits on the size of the deployment package, code
and libraries that can be deployed in the package.
 This could be severely limiting for some applications such as image
processing functions that depend on large libraries that have to be
packaged along with the code.
 Additionally, there are limits on the number of concurrent function
executions, ephemeral disk capacity (temp space) etc.
 While some of these limits are soft limits and can be reconfigured
per function by working with the providers, others are hard limits
and will force you to reevaluate the choice of your design.
8
 Latency - Due to the on-demand provisioning nature of the
FaaS infrastructure, applications that uses languages such
as Java/Scala that require a longer start time to spin up
JVMs may encounter longer runtime.
 Having said that, providers optimize the infrastructure spin-
ups based on the usage patterns of the functions.
 On the other hand, due to the interpreted nature of Python
and Javascript, functions written in these languages may
not see a significant difference in latency between a PaaS
and FaaS offering.
9
While there are new providers entering the market to exploit the Serverless wave,
the following rule the roost:
 Amazon with its AWS Lambda,
 Microsoft with its Azure Functions,
 Google with its Google Functions and
 IBM with its Openwhisk.
10
 Getting Started with Serverless Computing on AWS -
https://cloudacademy.com/learning-paths/getting-started-serverless-computing-25/
 Serverless Computing on AWS for Developers -
https://cloudacademy.com/learning-paths/serverless-computing-aws-developers-45/
 Serverless Workshop - https://cloudacademy.com/learning-paths/serverless-
workshop-64/
11
12
http://bit.ly/2qArW04
13
 Organizations want to diversify risk and hence do not want to be bound to
a single provider.
 While not having to manage infrastructure by using serverless functions is
nice, having to deal with hundreds of functions in a project between
multiple providers, managing buckets, messaging and permissions
becomes an issue in itself.
 While many providers are entering into the Serverless field to make
developing cloud-native applications easy, you are still bound to
idiosyncrasies of the provider when it comes to their FaaS offering.
 Not only do you have to learn the different terminologies used by the
various providers, you will have to learn how to use their offerings on their
respective consoles or CLI (Command Line Interface).
14
 The Serverless Framework is an MIT open-source project, actively
maintained by a vibrant and engaged community of developers and
provides robust plugins for various FaaS providers and allows to extend it
when needed.
 The Serverless Framework allows you to provision and deploy REST APIs,
backend services, data pipe-lines, and other uses cases by providing a
framework and CLI to build serverless services across many providers by
abstracting away provider-level complexity.
 The Serverless Framework is different than other application frameworks
because:
 It manages your code as well as your infrastructure
 It supports multiple languages (Node.js, Python, Java, and more)
15
Serverless Framework consists of the following core concepts:
Service
Function
Events
Resources
Plugins
16
Service - The unit of organization. It's where you define your Functions, the
Events that trigger them, and the Resources your Functions use, all in one
file titled serverless.yml. More information at: https://goo.gl/9SKBvx
An application can have multiple services and hence multiple serverless.yml
files.
17
Functions - A Function is an independent unit of deployment or
microservice. It manifests itself as a Lambda or Azure Function depending
upon the provider. It's merely code, deployed in the cloud, that is most often
written to perform a single job such as:
 Saving a user to the database
 Processing a file in a database
 Performing a scheduled task
18
Anything that triggers an Function to execute is regarded by the
Framework as an Event.
Events on AWS are:
 An AWS API Gateway HTTP endpoint request (e.g., for a REST API)
 An AWS S3 bucket upload (e.g., for an image)
 A CloudWatch timer (e.g., run every 5 minutes)
 An AWS SNS topic (e.g., a message)
 A CloudWatch Alert (e.g., something happened)
When you define an event for your functions in the Serverless Framework,
the Framework will automatically create any infrastructure necessary for
that event (e.g., an API Gateway endpoint) and configure your Functions to
listen to it.
19
Simply put, events are the things that trigger your functions to run. If you
are using AWS as your provider, all events in the service are anything in
AWS that can trigger an AWS Lambda function, like an S3 bucket upload,
an SNS topic, and HTTP endpoints created via API Gateway.
Upon deployment, the framework will deploy any infrastructure required for
an event (e.g., an API Gateway endpoint) and configure your function to
listen to it.
20
Resources are infrastructure components which your Functions uses.
If you use AWS as you provider, then resources are:
 An AWS DynamoDB Table (e.g., for saving Users/Posts/Comments data)
 An AWS S3 Bucket (e.g., for saving images or files)
 An AWS SNS Topic (e.g., for sending messages asynchronously)
Anything that can be defined in CloudFormation is supported by the
Serverless Framework
The Serverless Framework not only deploys your Functions and the Events
that trigger them, but it also deploys the infrastructure components your
Functions depend upon.
21
22
An example of resources in Serverless Framework using AWS as provider:
23
Serverless Framework needs access to your cloud provider account
credentials to deploy resources on your behalf. For AWS you can use AWS
CLI (aws configure). Azure is more involved.
Following links provide excellent guidance on setting up the credentials for
various providers currently supported on the Serverless Framework.
AWS -
https://serverless.com/framework/docs/providers/aws/guide/credentials/
Azure -
https://serverless.com/framework/docs/providers/azure/guide/credentials/
Openwhisk -
https://serverless.com/framework/docs/providers/openwhisk/guide/credential
s/
24
Serverless Framework translates the service declaration in the
serverless.yml file into a Cloud Formation or Resource Manager template
depending upon the provider you choose.
To deploy your service, all the functions and provision the resources, enter:
serverless deploy --verbose
To deploy a single function after making changes to it, enter:
serverless deploy function --function <myfunction> --verbose
25
Serverless Framework allows you to invoke a function locally for testing or
invoke a deployed function.
To invoke your function locally, enter:
serverless invoke local --function <myfunction> --log
To invoke a deployed function, enter:
serverless invoke function --function <myfunction> --stage <my
stage> --region <myregion>
Note: If you omit the stage and region option, the default stage (dev) and
region specified in your provider configuration will be used.
26
27
28
29
30
31
A celebrity face recognition service built with Serverless
Framework using Twilio, Amazon Rekognition and IMDbPy API.
The CelebritySleuth application is an event-driven application taking advantage
of:
 The user's mobile SMS/MMS for the presentation tier,
 Twilio in the middle-tier to bridge the SMS world and
 AWS Gateway and a set of AWS Lambda functions written in Python making use
of AWS Rekogniton for image processing and IMDB for gathering information on
the celebrities.
CelebritySleuth code repository, installation guide and usage at:
https://github.com/skarlekar/faces
32
To begin with you have to train the application to recognize the faces by
building a collection of celebrities. You do this by sending a random sample
of celebrity pictures (image URLs) and their corresponding names. The
more pictures of a celebrity, the more accurate the recognition will be.
The CelebritySleuth application consists of two services:
 Twilio Communication Service
 Face Recognition Service
The services are decoupled to allow for using different presentation tiers in
future.
33
34
1.USER SENDS A PICTURE AND COMMANDS TO
ADD/MATCH FACE TO A COLLECTION. THE
SMS/MMS IS SENT TO A TELEPHONE
NUMBER HOSTED BY TWILIO.
2.TWILIO INTERCEPTS THE MESSAGE AND
FORWARDS IT TO AN API GATEWAY BASED
ON THE USER’S TWILIO CONFIGURATION.
3.API GATEWAY TRANSLATES TWIML TO
JSON AND CALLS THE REQUEST
PROCESSOR LAMBDA FUNCTION.
4.THE REQUEST PROCESSOR LAMBDA
VALIDATES THE COMMANDS AND PUT A
MESSAGE TO THE APPROPRIATE TOPIC ON
SNS. IF THE VALIDATION FAILS, IT
RETURNS THE ERROR MESSAGE TO THE
USER VIA TWILIO.
5. WHEN A MESSAGE ARRIVES IN THE CREATE
COLLECTION TOPIC, A LAMBDA IS
TRIGGERED WHICH ADDS THE NAMED
COLLECTION IN AWS REKOGNITION VIA
BOTO LIBRARIES. A SUCCESS/ERROR
MESSAGE IS PUT IN THE RESPONSE
PROCESSOR TOPIC.
6.WHEN A MESSAGE ARRIVES IN ADD FACE
TOPIC, A LAMBDA IS TRIGGERED WHICH
IDENTIFIES THE MOST PROMINENT FACE IN
THE IMAGE AND ADDS THE METADATA FOR
THE FACE TO THE GIVEN COLLECTION. IF
THERE IS NO FACES IDENTIFIED, IT
CREATES AN ERROR MESSAGE AND SENDS
THE RESPONSE TO THE RESPONSE
PROCESSOR TOPIC.
7. WHEN A MESSAGE ARRIVES IN MATCH
FACE TOPIC, A LAMBDA IS TRIGGERED
WHICH IDENTIFIES THE MOST PROMINENT
FACE IN THE IMAGE AND MATCHES THE
METADATA FOR THAT FACE WITH KNOWN
FACES IN THE COLLECTION. IF A MATCH IS
FOUND, THE CORRESPONDING PERSON’S
NAME IS RETURNED. THE LAMBDA THEN
USES IMDB TO LOOKUP THE BIOGRAPHY
OF THE PERSON.
8. THE VARIOUS LAMBDA-BASED PROCESSORS
DROPS THE RESPONSE MESSAGE ON THE
RESPONSE PROCESSOR TOPIC.
9. THE RESPONSE PROCESSOR PICKS UP THE
RESPONSE AND CONSTRUCTS A SMS
MESSAGE AND CALLS TWILIO’S SMS
SERVICE.
10.TWILIO VALIDATES THE FROM NUMBER
AND SENDS THE MESSAGE TO THE
CORRESPONDING TO NUMBER.
35
The CelebritySleuth application can be cloned from:
https://github.com/skarlekar/faces
The two main services are:
Twilio Communication Service -
https://github.com/skarlekar/faces/tree/master/twilioCommunicationService
Face Recognition Service –
https://github.com/skarlekar/faces/tree/master/faceRecognitionService
36
Security – Wrap a security blanket around twilioCommunicationService
such that only authorized users are allowed to call the service. More
information at: https://www.twilio.com/docs/api/security#http-authentication
Validation – In addition to the security blanket above, validate that the
twilioCommunicationService is called only from Twilio. More information at:
https://www.twilio.com/docs/api/security#validating-requests
VPC – As the faceRecognitionService is an internal service, secure it within
a VPC. More information at:
https://serverless.com/framework/docs/providers/aws/guide/functions#vpc-
configuration

More Related Content

What's hot

Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
Nikolaus Graf
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
Julian Kleinhans
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
Scott Leberknight
 
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
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Amazon Web Services
 
Serverless Architectures.pdf
Serverless Architectures.pdfServerless Architectures.pdf
Serverless Architectures.pdf
Amazon Web Services
 
AWS Cloud trail
AWS Cloud trailAWS Cloud trail
AWS Cloud trail
zekeLabs Technologies
 
An introduction to AWS CloudFormation - Pop-up Loft Tel Aviv
An introduction to AWS CloudFormation - Pop-up Loft Tel AvivAn introduction to AWS CloudFormation - Pop-up Loft Tel Aviv
An introduction to AWS CloudFormation - Pop-up Loft Tel Aviv
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
 
Introduction To AWS & AWS Lambda
Introduction To AWS & AWS LambdaIntroduction To AWS & AWS Lambda
Introduction To AWS & AWS Lambda
An Nguyen
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
Amazon Web Services
 
AWSome Day 2016 - Module 1: AWS Introduction and History
AWSome Day 2016 - Module 1: AWS Introduction and HistoryAWSome Day 2016 - Module 1: AWS Introduction and History
AWSome Day 2016 - Module 1: AWS Introduction and History
Amazon Web Services
 
AWS IAM and security
AWS IAM and securityAWS IAM and security
AWS IAM and security
Erik Paulsson
 
Introduction to AWS Cost Management
Introduction to AWS Cost ManagementIntroduction to AWS Cost Management
Introduction to AWS Cost Management
Amazon Web Services
 
Intro to AWS Lambda
Intro to AWS Lambda Intro to AWS Lambda
Intro to AWS Lambda
Amazon Web Services
 
Serverless Architecture - A Gentle Overview
Serverless Architecture - A Gentle OverviewServerless Architecture - A Gentle Overview
Serverless Architecture - A Gentle Overview
CodeOps Technologies LLP
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
Amazon Web Services
 
Amazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better TogetherAmazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better Together
Danilo Poccia
 
AWS Account Best Practices
AWS Account Best PracticesAWS Account Best Practices
AWS Account Best Practices
Amazon Web Services
 
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar SeriesImproving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Amazon Web Services
 

What's hot (20)

Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
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
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
Serverless Architectures.pdf
Serverless Architectures.pdfServerless Architectures.pdf
Serverless Architectures.pdf
 
AWS Cloud trail
AWS Cloud trailAWS Cloud trail
AWS Cloud trail
 
An introduction to AWS CloudFormation - Pop-up Loft Tel Aviv
An introduction to AWS CloudFormation - Pop-up Loft Tel AvivAn introduction to AWS CloudFormation - Pop-up Loft Tel Aviv
An introduction to AWS CloudFormation - Pop-up Loft Tel Aviv
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
 
Introduction To AWS & AWS Lambda
Introduction To AWS & AWS LambdaIntroduction To AWS & AWS Lambda
Introduction To AWS & AWS Lambda
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
 
AWSome Day 2016 - Module 1: AWS Introduction and History
AWSome Day 2016 - Module 1: AWS Introduction and HistoryAWSome Day 2016 - Module 1: AWS Introduction and History
AWSome Day 2016 - Module 1: AWS Introduction and History
 
AWS IAM and security
AWS IAM and securityAWS IAM and security
AWS IAM and security
 
Introduction to AWS Cost Management
Introduction to AWS Cost ManagementIntroduction to AWS Cost Management
Introduction to AWS Cost Management
 
Intro to AWS Lambda
Intro to AWS Lambda Intro to AWS Lambda
Intro to AWS Lambda
 
Serverless Architecture - A Gentle Overview
Serverless Architecture - A Gentle OverviewServerless Architecture - A Gentle Overview
Serverless Architecture - A Gentle Overview
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
 
Amazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better TogetherAmazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better Together
 
AWS Account Best Practices
AWS Account Best PracticesAWS Account Best Practices
AWS Account Best Practices
 
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar SeriesImproving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
 

Similar to Building Serverless Microservices Using Serverless Framework on the Cloud

Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Srini Karlekar
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
Rajind Ruparathna
 
Service Models
Service ModelsService Models
Service Models
Allwyn24
 
Aws interview questions and answers
Aws interview questions and answersAws interview questions and answers
Aws interview questions and answers
kavinilavuG
 
Demistifying serverless on aws
Demistifying serverless on awsDemistifying serverless on aws
Demistifying serverless on aws
AWS Riyadh User Group
 
Serverless Architectures
Serverless Architectures Serverless Architectures
Serverless Architectures
SuraiyaHasan19004210
 
AWS Interview Questions and Answers -CREDO SYSTEMZ.pdf
AWS Interview Questions and Answers -CREDO SYSTEMZ.pdfAWS Interview Questions and Answers -CREDO SYSTEMZ.pdf
AWS Interview Questions and Answers -CREDO SYSTEMZ.pdf
nishajeni1
 
Cloud computing
Cloud computingCloud computing
Cloud computing
gd1410
 
When to use serverless computing.pdf
When to use serverless computing.pdfWhen to use serverless computing.pdf
When to use serverless computing.pdf
SGBSeo
 
When to use serverless computing.pdf
When to use serverless computing.pdfWhen to use serverless computing.pdf
When to use serverless computing.pdf
seo18
 
Module 3-cloud computing
Module 3-cloud computingModule 3-cloud computing
Module 3-cloud computing
Sweta Kumari Barnwal
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)
Ashish Kushwaha
 
Testing of Serverless Application on Amazon WebService Cloud
Testing of Serverless Application on Amazon WebService CloudTesting of Serverless Application on Amazon WebService Cloud
Testing of Serverless Application on Amazon WebService Cloud
Rustam Zeynalov
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
Mohammad Shakirul islam
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architecturesAws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
sonpro2312
 
AWS Lambda Documentation
AWS Lambda DocumentationAWS Lambda Documentation
AWS Lambda Documentation
Whizlabs
 
Comparative Study of Various Platform as a Service Frameworks
Comparative Study of Various Platform as a Service Frameworks Comparative Study of Various Platform as a Service Frameworks
Comparative Study of Various Platform as a Service Frameworks
neirew J
 
COMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKS
COMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKSCOMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKS
COMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKS
ijccsa
 
Cloud Architecture - Multi Cloud, Edge, On-Premise
Cloud Architecture - Multi Cloud, Edge, On-PremiseCloud Architecture - Multi Cloud, Edge, On-Premise
Cloud Architecture - Multi Cloud, Edge, On-Premise
Araf Karsh Hamid
 
Serverless architecture
Serverless architectureServerless architecture
Serverless architecture
Shubham_Indrawat
 

Similar to Building Serverless Microservices Using Serverless Framework on the Cloud (20)

Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
Service Models
Service ModelsService Models
Service Models
 
Aws interview questions and answers
Aws interview questions and answersAws interview questions and answers
Aws interview questions and answers
 
Demistifying serverless on aws
Demistifying serverless on awsDemistifying serverless on aws
Demistifying serverless on aws
 
Serverless Architectures
Serverless Architectures Serverless Architectures
Serverless Architectures
 
AWS Interview Questions and Answers -CREDO SYSTEMZ.pdf
AWS Interview Questions and Answers -CREDO SYSTEMZ.pdfAWS Interview Questions and Answers -CREDO SYSTEMZ.pdf
AWS Interview Questions and Answers -CREDO SYSTEMZ.pdf
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
When to use serverless computing.pdf
When to use serverless computing.pdfWhen to use serverless computing.pdf
When to use serverless computing.pdf
 
When to use serverless computing.pdf
When to use serverless computing.pdfWhen to use serverless computing.pdf
When to use serverless computing.pdf
 
Module 3-cloud computing
Module 3-cloud computingModule 3-cloud computing
Module 3-cloud computing
 
AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)AWS Serverless Introduction (Lambda)
AWS Serverless Introduction (Lambda)
 
Testing of Serverless Application on Amazon WebService Cloud
Testing of Serverless Application on Amazon WebService CloudTesting of Serverless Application on Amazon WebService Cloud
Testing of Serverless Application on Amazon WebService Cloud
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architecturesAws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
 
AWS Lambda Documentation
AWS Lambda DocumentationAWS Lambda Documentation
AWS Lambda Documentation
 
Comparative Study of Various Platform as a Service Frameworks
Comparative Study of Various Platform as a Service Frameworks Comparative Study of Various Platform as a Service Frameworks
Comparative Study of Various Platform as a Service Frameworks
 
COMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKS
COMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKSCOMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKS
COMPARATIVE STUDY OF VARIOUS PLATFORM AS A SERVICE FRAMEWORKS
 
Cloud Architecture - Multi Cloud, Edge, On-Premise
Cloud Architecture - Multi Cloud, Edge, On-PremiseCloud Architecture - Multi Cloud, Edge, On-Premise
Cloud Architecture - Multi Cloud, Edge, On-Premise
 
Serverless architecture
Serverless architectureServerless architecture
Serverless architecture
 

Recently uploaded

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 

Recently uploaded (20)

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 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
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 

Building Serverless Microservices Using Serverless Framework on the Cloud

  • 1. Srini Karlekar – Director, Software Engineering, Capital One. Twitter: @skarlekar
  • 2.  Serverless Architectures are those models where the applications logic provided by the Developer is run on stateless, compute containers that are provisioned and managed by a provider.  Typically these compute instances are ephemeral (short-lived for the duration of the request-response cycle), typically runs a function and triggered through an event.  Due to the on-demand provisioning nature of this architecture, the systems built using Serverless technologies are inherently scalable and highly responsive under load. 2
  • 3.  The introduction of function PaaS1 (fPaaS) as Lambda by Amazon in re:Invent, Nov 2014 (and out of beta in late 2015) created a momentum for "serverless" platform architecture. AWS Lambda was soon followed by most major cloud platform vendors, including IBM, Microsoft, Google and, more recently, Oracle. Serverless is a cloud-native platform model.  Per Gartner, by 2022 most cloud architectures will evolve to a fundamentally serverless model rendering the cloud platform architectures dominating in 2017 as legacy architectures2.  Serverless is a cloud-native platform model and reflects the core-promise of cloud- computing by offering agility and capability on demand at a value price. 3 1. Platform as a Service. 2. The Key Trends in PaaS, 2017 - Published: 31 January 2017 ID: G00313016
  • 4.  Serverless computing model is an emerging trend and quite often misunderstood because of the hype and build-up surrounding the topic.  The term Serverless refers to building applications without having to configure or maintain infrastructure required for running your applications on the cloud.  In reality, servers are still involved, though they are owned and controlled by the platform providers.  On the other hand there are frameworks used for exploiting the serverless architecture uninspiringly named Serverless Framework increasing the confusion. 4
  • 5. 5
  • 6.  FaaS - The technique of building applications using Serverless architecture.  Cost Efficiency – Pay per execution model is most efficient at managing costs.  Ephemeral – Short-lived process triggered via event.  Auto-scaling – Compute resources are provisioned granularly per request.  Event-driven – Functions respond to events such as http, file drop, alerts, timer, topics etc  Microservices – Modules built to satisfy a specific goal and uses a simple, well-defined interface. 6
  • 7.  State - Due to the ephemeral nature of the FaaS architecture, the state of your application should be managed externally from the FaaS infrastructure or off-loaded to a cache or data-base.  Duration - Because of the on-demand provisioning and low-cost nature of the FaaS solution there is a restriction on how long your functions are allowed to run. To keep the price low - as you are billed by minutes of usage, some providers such as Amazon AWS and Microsoft Azure restrict the duration of time a function is allowed to process a request. 7
  • 8.  Deployment & Resource Limits - Some providers such as AWS have deployment limits on the size of the deployment package, code and libraries that can be deployed in the package.  This could be severely limiting for some applications such as image processing functions that depend on large libraries that have to be packaged along with the code.  Additionally, there are limits on the number of concurrent function executions, ephemeral disk capacity (temp space) etc.  While some of these limits are soft limits and can be reconfigured per function by working with the providers, others are hard limits and will force you to reevaluate the choice of your design. 8
  • 9.  Latency - Due to the on-demand provisioning nature of the FaaS infrastructure, applications that uses languages such as Java/Scala that require a longer start time to spin up JVMs may encounter longer runtime.  Having said that, providers optimize the infrastructure spin- ups based on the usage patterns of the functions.  On the other hand, due to the interpreted nature of Python and Javascript, functions written in these languages may not see a significant difference in latency between a PaaS and FaaS offering. 9
  • 10. While there are new providers entering the market to exploit the Serverless wave, the following rule the roost:  Amazon with its AWS Lambda,  Microsoft with its Azure Functions,  Google with its Google Functions and  IBM with its Openwhisk. 10
  • 11.  Getting Started with Serverless Computing on AWS - https://cloudacademy.com/learning-paths/getting-started-serverless-computing-25/  Serverless Computing on AWS for Developers - https://cloudacademy.com/learning-paths/serverless-computing-aws-developers-45/  Serverless Workshop - https://cloudacademy.com/learning-paths/serverless- workshop-64/ 11
  • 13. 13
  • 14.  Organizations want to diversify risk and hence do not want to be bound to a single provider.  While not having to manage infrastructure by using serverless functions is nice, having to deal with hundreds of functions in a project between multiple providers, managing buckets, messaging and permissions becomes an issue in itself.  While many providers are entering into the Serverless field to make developing cloud-native applications easy, you are still bound to idiosyncrasies of the provider when it comes to their FaaS offering.  Not only do you have to learn the different terminologies used by the various providers, you will have to learn how to use their offerings on their respective consoles or CLI (Command Line Interface). 14
  • 15.  The Serverless Framework is an MIT open-source project, actively maintained by a vibrant and engaged community of developers and provides robust plugins for various FaaS providers and allows to extend it when needed.  The Serverless Framework allows you to provision and deploy REST APIs, backend services, data pipe-lines, and other uses cases by providing a framework and CLI to build serverless services across many providers by abstracting away provider-level complexity.  The Serverless Framework is different than other application frameworks because:  It manages your code as well as your infrastructure  It supports multiple languages (Node.js, Python, Java, and more) 15
  • 16. Serverless Framework consists of the following core concepts: Service Function Events Resources Plugins 16
  • 17. Service - The unit of organization. It's where you define your Functions, the Events that trigger them, and the Resources your Functions use, all in one file titled serverless.yml. More information at: https://goo.gl/9SKBvx An application can have multiple services and hence multiple serverless.yml files. 17
  • 18. Functions - A Function is an independent unit of deployment or microservice. It manifests itself as a Lambda or Azure Function depending upon the provider. It's merely code, deployed in the cloud, that is most often written to perform a single job such as:  Saving a user to the database  Processing a file in a database  Performing a scheduled task 18
  • 19. Anything that triggers an Function to execute is regarded by the Framework as an Event. Events on AWS are:  An AWS API Gateway HTTP endpoint request (e.g., for a REST API)  An AWS S3 bucket upload (e.g., for an image)  A CloudWatch timer (e.g., run every 5 minutes)  An AWS SNS topic (e.g., a message)  A CloudWatch Alert (e.g., something happened) When you define an event for your functions in the Serverless Framework, the Framework will automatically create any infrastructure necessary for that event (e.g., an API Gateway endpoint) and configure your Functions to listen to it. 19
  • 20. Simply put, events are the things that trigger your functions to run. If you are using AWS as your provider, all events in the service are anything in AWS that can trigger an AWS Lambda function, like an S3 bucket upload, an SNS topic, and HTTP endpoints created via API Gateway. Upon deployment, the framework will deploy any infrastructure required for an event (e.g., an API Gateway endpoint) and configure your function to listen to it. 20
  • 21. Resources are infrastructure components which your Functions uses. If you use AWS as you provider, then resources are:  An AWS DynamoDB Table (e.g., for saving Users/Posts/Comments data)  An AWS S3 Bucket (e.g., for saving images or files)  An AWS SNS Topic (e.g., for sending messages asynchronously) Anything that can be defined in CloudFormation is supported by the Serverless Framework The Serverless Framework not only deploys your Functions and the Events that trigger them, but it also deploys the infrastructure components your Functions depend upon. 21
  • 22. 22 An example of resources in Serverless Framework using AWS as provider:
  • 23. 23 Serverless Framework needs access to your cloud provider account credentials to deploy resources on your behalf. For AWS you can use AWS CLI (aws configure). Azure is more involved. Following links provide excellent guidance on setting up the credentials for various providers currently supported on the Serverless Framework. AWS - https://serverless.com/framework/docs/providers/aws/guide/credentials/ Azure - https://serverless.com/framework/docs/providers/azure/guide/credentials/ Openwhisk - https://serverless.com/framework/docs/providers/openwhisk/guide/credential s/
  • 24. 24 Serverless Framework translates the service declaration in the serverless.yml file into a Cloud Formation or Resource Manager template depending upon the provider you choose. To deploy your service, all the functions and provision the resources, enter: serverless deploy --verbose To deploy a single function after making changes to it, enter: serverless deploy function --function <myfunction> --verbose
  • 25. 25 Serverless Framework allows you to invoke a function locally for testing or invoke a deployed function. To invoke your function locally, enter: serverless invoke local --function <myfunction> --log To invoke a deployed function, enter: serverless invoke function --function <myfunction> --stage <my stage> --region <myregion> Note: If you omit the stage and region option, the default stage (dev) and region specified in your provider configuration will be used.
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29
  • 30. 30
  • 31. 31 A celebrity face recognition service built with Serverless Framework using Twilio, Amazon Rekognition and IMDbPy API. The CelebritySleuth application is an event-driven application taking advantage of:  The user's mobile SMS/MMS for the presentation tier,  Twilio in the middle-tier to bridge the SMS world and  AWS Gateway and a set of AWS Lambda functions written in Python making use of AWS Rekogniton for image processing and IMDB for gathering information on the celebrities. CelebritySleuth code repository, installation guide and usage at: https://github.com/skarlekar/faces
  • 32. 32 To begin with you have to train the application to recognize the faces by building a collection of celebrities. You do this by sending a random sample of celebrity pictures (image URLs) and their corresponding names. The more pictures of a celebrity, the more accurate the recognition will be. The CelebritySleuth application consists of two services:  Twilio Communication Service  Face Recognition Service The services are decoupled to allow for using different presentation tiers in future.
  • 33. 33
  • 34. 34 1.USER SENDS A PICTURE AND COMMANDS TO ADD/MATCH FACE TO A COLLECTION. THE SMS/MMS IS SENT TO A TELEPHONE NUMBER HOSTED BY TWILIO. 2.TWILIO INTERCEPTS THE MESSAGE AND FORWARDS IT TO AN API GATEWAY BASED ON THE USER’S TWILIO CONFIGURATION. 3.API GATEWAY TRANSLATES TWIML TO JSON AND CALLS THE REQUEST PROCESSOR LAMBDA FUNCTION. 4.THE REQUEST PROCESSOR LAMBDA VALIDATES THE COMMANDS AND PUT A MESSAGE TO THE APPROPRIATE TOPIC ON SNS. IF THE VALIDATION FAILS, IT RETURNS THE ERROR MESSAGE TO THE USER VIA TWILIO. 5. WHEN A MESSAGE ARRIVES IN THE CREATE COLLECTION TOPIC, A LAMBDA IS TRIGGERED WHICH ADDS THE NAMED COLLECTION IN AWS REKOGNITION VIA BOTO LIBRARIES. A SUCCESS/ERROR MESSAGE IS PUT IN THE RESPONSE PROCESSOR TOPIC. 6.WHEN A MESSAGE ARRIVES IN ADD FACE TOPIC, A LAMBDA IS TRIGGERED WHICH IDENTIFIES THE MOST PROMINENT FACE IN THE IMAGE AND ADDS THE METADATA FOR THE FACE TO THE GIVEN COLLECTION. IF THERE IS NO FACES IDENTIFIED, IT CREATES AN ERROR MESSAGE AND SENDS THE RESPONSE TO THE RESPONSE PROCESSOR TOPIC. 7. WHEN A MESSAGE ARRIVES IN MATCH FACE TOPIC, A LAMBDA IS TRIGGERED WHICH IDENTIFIES THE MOST PROMINENT FACE IN THE IMAGE AND MATCHES THE METADATA FOR THAT FACE WITH KNOWN FACES IN THE COLLECTION. IF A MATCH IS FOUND, THE CORRESPONDING PERSON’S NAME IS RETURNED. THE LAMBDA THEN USES IMDB TO LOOKUP THE BIOGRAPHY OF THE PERSON. 8. THE VARIOUS LAMBDA-BASED PROCESSORS DROPS THE RESPONSE MESSAGE ON THE RESPONSE PROCESSOR TOPIC. 9. THE RESPONSE PROCESSOR PICKS UP THE RESPONSE AND CONSTRUCTS A SMS MESSAGE AND CALLS TWILIO’S SMS SERVICE. 10.TWILIO VALIDATES THE FROM NUMBER AND SENDS THE MESSAGE TO THE CORRESPONDING TO NUMBER.
  • 35. 35 The CelebritySleuth application can be cloned from: https://github.com/skarlekar/faces The two main services are: Twilio Communication Service - https://github.com/skarlekar/faces/tree/master/twilioCommunicationService Face Recognition Service – https://github.com/skarlekar/faces/tree/master/faceRecognitionService
  • 36. 36 Security – Wrap a security blanket around twilioCommunicationService such that only authorized users are allowed to call the service. More information at: https://www.twilio.com/docs/api/security#http-authentication Validation – In addition to the security blanket above, validate that the twilioCommunicationService is called only from Twilio. More information at: https://www.twilio.com/docs/api/security#validating-requests VPC – As the faceRecognitionService is an internal service, secure it within a VPC. More information at: https://serverless.com/framework/docs/providers/aws/guide/functions#vpc- configuration

Editor's Notes

  1. The technique of building applications using Serverless architecture is known as FaaS (Function as a Service). The reason becomes clear when you contrast FaaS applications with the traditionally built applications or PaaS (Platform as a Service) where there is a perpetual process running on a server waiting for HTTP requests or API calls. In FaaS there is no perpetual process (for the most part) but an event mechanism that triggers the execution of a piece of code, usually just a function. You still need a perpetual gateway that will field your API calls to start the events to cascade. The other key operational difference between FaaS and PaaS is scaling. With most PaaS solutions you still need to worry about scale. With FaaS the compute resources are provisioned at a request level. You cannot get the same level of granularity with PaaS applications even if you set it to auto-scale. As a result of this, FaaS applications are extremely efficient when it comes to managing cost.