SlideShare a Scribd company logo
Demystifying
Serverless on
AWS Riyadh User Group
Ahmed Samir
Solution Architect Associate
Technical Architect – Banking Sector
12 years experience in IT Field
Development Background in Microsoft stack
Organize Cloud Communities in Riyadh
/in/aseldesouky/ aseldesouky
AWSbelaraby
AWSbelaraby
#AWS_‫بالعربي‬
http://bit.ly/2vbnFH4
Agenda
• How we got to where we are?
• What's Serverless
• Serverless Principles
• Pros and cons
• Serverless architectures
• Lambda Anatomy
• Demos
• AWS SAM
• Demo
How we got to where we are?
Microservices SOA Monolithic
Design Services are built in small units
and expressed formally
with business-oriented APIs.
Services can range in size anywhere
from small application services to
very large enterprise services
including much more business
functionality.
Monolithic applications evolve into
huge size, a situation where
understanding the entirety of the
application is difficult.
Usability Services exposed with a standard
protocol, such as a RESTful
API, and consumed/reused by
other services and applications.
Services exposed with a standard
protocol, such as SOAP and
consumed/reused by other services
– leverage messaging middleware.
Limited re-use is realized across
monolithic applications.
Scalability Services exist as independent
deployment artifacts and can be
scaled independently of other
services.
Dependencies between services and
reusable sub-components can
introduce scaling challenges.
Scaling monolithic applications can
often be a challenge.
Agility Smaller independent deployable
units ease build/release
management, thereby high
operational agility.
Enhances components sharing that
increases dependencies and limits
management capabilities.
Difficult to achieve operational agility
in the repeated deployment of
monolithic application artifacts.
Development Developing services discretely
allows developers to use the
appropriate development
framework for the task at hand.
Reusable components and standard
practices helps developers with
implementation.
Monolithic applications are
implemented using a single
development stack (i.e., JEE or .NET),
which can limit the availability of
“the right tool for the job”.
XaaS
Infrastructure as a Service
(IaaS)
Software as a Service
(SaaS)
Platform as a Service
(PaaS)
Container as a Service
(CaaS)
Function as a Service
(FaaS)
base infrastructure (Virtual machine, Software Define Network, Storage attached)
AWS (EC2), Azure
VMmanaged by vendors: applications, runtime, data, middleware, OSes, virtualization,
servers, storage and networking, End users have to use it
Gmail, SAP,
SalesforceIt provides a platform allowing end user to develop, run, and manage applications
without the complexity of building and maintaining the infrastructure
AWS (Beanstalk)
container-based virtualization in which container engines, orchestration and the
underlying compute resources are delivered to users as a service from a cloud
providerAWS (ECS), Azure (ACS)
It provides a platform allowing customers to develop, run, and manage application
functionalities without the complexity of building and maintaining the infrastructure
AWS Lambda
Demistifying serverless on aws
Serverless
• Focus entirely on the business logic of your
applications.
• You don't have to think about servers, provisioned
infrastructure, networking, virtual machine etc.
• All this stuff is handled for you by a cloud provider
(AWS in case o Lambda).
• Usually it means, that your application heavily
relies on managed services (like Lambda,
DynamoDB, API Gateway) that are maintained by
a cloud provider and allow you to abstract the
server away
Serverless Principles
• Use a compute service to execute code on demand (no servers)
• Write single-purpose stateless functions
• Design push-based, event-driven pipelines
• Create thicker, more powerful front ends.
• Embrace third-party services
Serverless Principles
Demistifying serverless on aws
• Greater Agility
• Less Operations
• Faster time to market
• Cost growth with your business
• Simplifies packaging and deployment and
requires no system administration.
• Reduces the complexity of software.
• Fits with microservices, which can be
implemented as functions.
• Serverless is not efficient for long-running applications
• Vendor lock-in
• Serverless (and microservice) architectures introduce
additional overhead for function/microservice calls.
• To utilize its resources more efficiently, a service
provider may run software for several different
customers on the same physical server (this is also
known as “multitenancy”)
• In practice, it takes some time for a scalable serverless
platform to handle a first request by your function –
Cold Start
When to use
Serverless?
•No More Servers
•Startups that want to innovate and move quickly
•Low and expected cost
•Less Code
•Scalable And Flexible
Serverless Architectures
Compute as backend
an approach where a serverless compute service
such as Lambda and third-party services are used to
build a back end for web, mobile, and desktop
applications
The front-end can links directly to the database and an authentication
service. This is because there’s no need to put every service behind
an API Gateway if the front end can communicate with them in a
secure manner for example, using delegation tokens;
Compute as backend
Use Case
Demistifying serverless on aws
A Cloud Guru Architecture details
• The front end is built using AngularJS and is hosted by Netlify.
You could use S3 and CloudFront (CloudFront is a global content
delivery network provided by AWS) instead of Netlify if you
wanted to
• Auth0 is used to provide registration and authentication facilities.
It creates delegation tokens that allow the front end to directly
and securely communicate with other services such as Firebase.
• Firebase is the real-time database used by A Cloud Guru. Every
client creates a connection to Firebase using web sockets and
receives updates from it in near real time. This means that clients
receive updates as they happen without having to poll.
A Cloud Guru Architecture
details
• Lecturers who create content for the platform can upload files
(usually videos, but they could be other types) straight to S3
buckets via their browser. For this to work, the web application
invokes a Lambda function (via the API Gateway) to request the
necessary upload credentials first. As soon as credentials are
retrieved, the client web application begins a file upload to S3 via
HTTP. All of this happens behind the scenes and is opaque to the
user
A Cloud Guru Architecture
details
• Once a file is uploaded to S3, it automatically kicks off a chain of
events (event-driven pipeline) that transcodes the video, saves new
files in another bucket, updates the database, and immediately
makes transcoded videos available to other users. Throughout this
book you’ll write a similar system and see how it works in detail.
• To view videos, users are given permission by another Lambda
function. Permissions are valid for 24 hours, after which they must
be renewed. Files are accessed via CloudFront.
A Cloud Guru Architecture
details
• Users can submit questions and answers to the forums.
Questions, answers, and comments are recorded in the
database. This data is then sent for indexing to AWS CloudSearch,
which is a managed searching and indexing service from AWS.
This allows users to search and view questions, answers, and
comments that other people have written
Legacy API proxy
• Systems with outdated services and APIs can be difficult to
use in modern environments.
• They might not conform to modern protocols or standards,
which might make interoperability with current systems
harder.
• One way to alleviate this problem is to use the API Gateway
and Lambda in front of those legacy services.
• The API Gateway and Lambda functions can transform
requests made by clients and invoke legacy services directly
Legacy API proxy
Hybrid
• The hybrid approach may work especially well if a part of
the existing infrastructure is already in AWS.
• We’ve also seen adoption of serverless technologies and
architectures in organizations with developers initially
creating standalone components (often to do additional
data processing, database backups, and basic alerting) and
over time integrating these components into their main
systems
Hybrid
GraphQL
• Popular data query language developed by Facebook in
2012 and released publicly in 2015.
• It was designed as an alternative to REST (Representational
State Transfer) because of REST’s perceived weaknesses
(multiple round-trips, over-fetching, and problems with
versioning).
• GraphQL attempts to solve these problems by providing a
hierarchical, declarative way of performing queries from a
single end point
Legacy API proxy
Compute as glue
we can use Lambda functions to create powerful
execution pipelines and workflows.
This often involves using Lambda as glue between
different services, coordinating and invoking them.
With this style of architecture, the focus of the
developer is on the design of their pipeline,
coordination, and flow of data.
Compute as glue
Real-time processing
Amazon Kinesis Streams is a technology that can
help process and analyze large amounts of
streaming data. This data can include logs, events,
transactions, social media feeds—virtually anything
you can think of
It’s a good way to continuously collect data that may
change over time. Lambda is a perfect tool for
Kinesis Streams because it scales automatically in
response to how much data there is to process
Real-time processing
Serverless Architectures
1. Compute as back end
2. Compute as glue
3. Legacy API wrapper
4. Hybrid
5. GraphQL
6. Real-time processing
Demistifying serverless on aws
Lambda can be described as Function as a Service (FaaS), where the
functions is the main building block and execution unit. No servers to
manage, no virtual machines, clusters, containers, just a function created in
one of the supported languages
As with any other managed service, provisioning, scaling and reliability is
handled automatically by AWS. This allows us to work on a very high
abstraction level, focus entirely on the business logic and (almost) forget
about underlying resources.
Lambda Runtimes
Node.js 10
Node.js 12
Python 3.8
Python 3.7
Python 3.6
Python 2.7
Ruby 2.5
Java 8
Java 11
Go 1.x.NET Core 2.1
Lambda Event Sources
Synchronous vs Asynchronous
Event provides function with the detailed information about the event that has triggered the
execution (for example, Event from API Gateway can be used to retrieve request details such
as query parameters, header or even request body)
Context on the other hand, contains methods and properties that provide information about
the invocation, function, and execution environment (such as assigned memory limit or
upcoming execution timeout).
Quick Demo
Cold Start
1. Download your code
2. Set up a runtime environment, together with the resources
specified in the Lambda configuration
The exact length of the Cold Start
varies, depending on your code
package size and settings
For that reason it's wise to keep you
code package size as small as
possible
Take care of node_modules size
First Time o idle for a longer period of time
Warm Start
after handler execution. For some time, the
runtime remains active and can receive new
events
Warm execution is of course much faster than the cold one
we cannot assume that the function will, or will not be called with a cold or warm start
The time for which the function stays warm is not precisely defined in the documentation
and is actually based on your configuration and actual Lambda usage
If such event occurs, the warm runtime does
not have to be initialized again, it can execute
the handler immediately
If you allow concurrency of your Lambdas, newly created Lambda instances will also start
with a cold start.
Initialization vs handler
it's recommended, to store all the initialization code outside of the handler function. All the
initialization (like creating database connection), should be done outside of handler and
just used inside it.
ScalingAuto scaling of Lambda functions is handled automatically by Lambda service.
By default, Lambda is trying to handle
incoming invocation requests by
reusing the existing warm runtimes.
This works if the function execution
time is shorter then the time between
upcoming requests
if the time between the events is < the
function execution time, the single
function instance is not able to handle
those invocation requests.
ScalingAuto scaling of Lambda functions is handled automatically by Lambda service.
If Lambda receives a new invocation request while all the current runtimes are busy, it will create another
runtime. This new runtime will handle the upcoming invocation request and execute the function code.
Then runtime remains in the warm state for some time and can receive new requests. If the runtime stays
idle for a longer period of time, Lambda terminates it to free the resources.
AWS Lambda Limits
1000
Concurrent executions
Lambda invocation flow
The invocation request is passed by Load Balancer to a selected Frontend
Invoker, Frontend Invoker checks the request, and asks the Worker Manager for a
sandboxed function that will handle the invocation. Worker Manager either finds a
proper Worker and a sandbox, or creates one. Once it's ready, the code is executed
by a Worker
Isolation
The technology that powers this
flow is Firecracker. It's an open
source (link) project that allows
AWS to span hundreds and
thousands lightweight
sandboxes on a single Worker.
https://firecracker-microvm.github.io/
Workers can be reused across
multiple Lambdas and even
Accounts, which allows
the Placement Service to
organize the work to create and
apply the most performant usage
patterns as possible.
Pricing – By Region
Pricing – Example
If you allocated 512MB of memory
to your function, executed it 3
million times in one month, and it
ran for 1 second each time, your
charges would be calculated as
follows:
https://aws.amazon.com/lambda/pricing/
http://serverlesscalc.com/
Orchestrations
AWS Step Functions
AWS Step Functions
Demo
AWS Serverless Application Model
SAM
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demistifying serverless on aws
Demo
https://cicd.serverlessworkshops.io/
https://github.com/aws-samples/aws-serverless-airline-booking
Demistifying serverless on aws
Ad

More Related Content

Similar to Demistifying serverless on aws (20)

Introduction to Azure fundamentals of cloud.pptx
Introduction to Azure fundamentals of cloud.pptxIntroduction to Azure fundamentals of cloud.pptx
Introduction to Azure fundamentals of cloud.pptx
Nadir Arain
 
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
RapidValue
 
Serverless Architectures
Serverless Architectures Serverless Architectures
Serverless Architectures
SuraiyaHasan19004210
 
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
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architecturesAws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
sonpro2312
 
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
 
CLOUD COMPUTING.pptx
CLOUD COMPUTING.pptxCLOUD COMPUTING.pptx
CLOUD COMPUTING.pptx
SurajThapa79
 
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
Srini Karlekar
 
Cloud description
Cloud descriptionCloud description
Cloud description
thanuambika
 
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
 
Third party cloud services cloud computing
Third party cloud services cloud computingThird party cloud services cloud computing
Third party cloud services cloud computing
SohailAliMalik
 
Serverless: Market Overview and Investment Opportunities
Serverless: Market Overview and Investment OpportunitiesServerless: Market Overview and Investment Opportunities
Serverless: Market Overview and Investment Opportunities
Underscore VC
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
Rajind Ruparathna
 
Technology Overview
Technology OverviewTechnology Overview
Technology Overview
Liran Zelkha
 
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Microservices and Serverless for Mega Startups - DevOps IL MeetupMicroservices and Serverless for Mega Startups - DevOps IL Meetup
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Boaz Ziniman
 
Aws re invent 2018 recap
Aws re invent 2018 recapAws re invent 2018 recap
Aws re invent 2018 recap
CloudHesive
 
From Serverless to InterCloud
From Serverless to InterCloudFrom Serverless to InterCloud
From Serverless to InterCloud
Wayne Scarano
 
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdfGreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
Dhaval Nagar
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
Tammy Bednar
 
Introduction to Azure fundamentals of cloud.pptx
Introduction to Azure fundamentals of cloud.pptxIntroduction to Azure fundamentals of cloud.pptx
Introduction to Azure fundamentals of cloud.pptx
Nadir Arain
 
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
RapidValue
 
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
 
Aws serverless multi-tier_architectures
Aws serverless multi-tier_architecturesAws serverless multi-tier_architectures
Aws serverless multi-tier_architectures
sonpro2312
 
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
 
CLOUD COMPUTING.pptx
CLOUD COMPUTING.pptxCLOUD COMPUTING.pptx
CLOUD COMPUTING.pptx
SurajThapa79
 
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
Srini Karlekar
 
Cloud description
Cloud descriptionCloud description
Cloud description
thanuambika
 
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
 
Third party cloud services cloud computing
Third party cloud services cloud computingThird party cloud services cloud computing
Third party cloud services cloud computing
SohailAliMalik
 
Serverless: Market Overview and Investment Opportunities
Serverless: Market Overview and Investment OpportunitiesServerless: Market Overview and Investment Opportunities
Serverless: Market Overview and Investment Opportunities
Underscore VC
 
Technology Overview
Technology OverviewTechnology Overview
Technology Overview
Liran Zelkha
 
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Microservices and Serverless for Mega Startups - DevOps IL MeetupMicroservices and Serverless for Mega Startups - DevOps IL Meetup
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Boaz Ziniman
 
Aws re invent 2018 recap
Aws re invent 2018 recapAws re invent 2018 recap
Aws re invent 2018 recap
CloudHesive
 
From Serverless to InterCloud
From Serverless to InterCloudFrom Serverless to InterCloud
From Serverless to InterCloud
Wayne Scarano
 
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdfGreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
Dhaval Nagar
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
Tammy Bednar
 

More from AWS Riyadh User Group (17)

Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...
Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...
Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...
AWS Riyadh User Group
 
Amazon SageMaker Build, Train and Deploy Your ML Models
Amazon SageMaker Build, Train and Deploy Your ML ModelsAmazon SageMaker Build, Train and Deploy Your ML Models
Amazon SageMaker Build, Train and Deploy Your ML Models
AWS Riyadh User Group
 
AWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on aws
AWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on awsAWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on aws
AWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on aws
AWS Riyadh User Group
 
AWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in aws
AWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in awsAWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in aws
AWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in aws
AWS Riyadh User Group
 
AWS Technical Day Riyadh Nov 2019 [Migration]
AWS Technical Day Riyadh Nov 2019 [Migration]AWS Technical Day Riyadh Nov 2019 [Migration]
AWS Technical Day Riyadh Nov 2019 [Migration]
AWS Riyadh User Group
 
AWS Amplify
AWS AmplifyAWS Amplify
AWS Amplify
AWS Riyadh User Group
 
EC2 and S3 Level 100
EC2 and S3 Level 100EC2 and S3 Level 100
EC2 and S3 Level 100
AWS Riyadh User Group
 
Devops on AWS
Devops on AWSDevops on AWS
Devops on AWS
AWS Riyadh User Group
 
Blockchain on AWS
Blockchain on AWSBlockchain on AWS
Blockchain on AWS
AWS Riyadh User Group
 
AWS AI Services
AWS AI ServicesAWS AI Services
AWS AI Services
AWS Riyadh User Group
 
AWS Cloudformation Session 01
AWS Cloudformation Session 01AWS Cloudformation Session 01
AWS Cloudformation Session 01
AWS Riyadh User Group
 
AWS Cloud Security
AWS Cloud SecurityAWS Cloud Security
AWS Cloud Security
AWS Riyadh User Group
 
AWS Messaging
AWS MessagingAWS Messaging
AWS Messaging
AWS Riyadh User Group
 
Amazon Virtual Private Cloud - VPC 2
Amazon Virtual Private Cloud - VPC 2Amazon Virtual Private Cloud - VPC 2
Amazon Virtual Private Cloud - VPC 2
AWS Riyadh User Group
 
Amazon Virtual Private Cloud - VPC 1
Amazon Virtual Private Cloud - VPC 1Amazon Virtual Private Cloud - VPC 1
Amazon Virtual Private Cloud - VPC 1
AWS Riyadh User Group
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
AWS Riyadh User Group
 
Amazon relational database service (rds)
Amazon relational database service (rds)Amazon relational database service (rds)
Amazon relational database service (rds)
AWS Riyadh User Group
 
Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...
Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...
Cutting to the chase for Machine Learning Analytics Ecosystem & AWS Lake Form...
AWS Riyadh User Group
 
Amazon SageMaker Build, Train and Deploy Your ML Models
Amazon SageMaker Build, Train and Deploy Your ML ModelsAmazon SageMaker Build, Train and Deploy Your ML Models
Amazon SageMaker Build, Train and Deploy Your ML Models
AWS Riyadh User Group
 
AWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on aws
AWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on awsAWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on aws
AWS Technical Day Riyadh Nov 2019 - The art of mastering data protection on aws
AWS Riyadh User Group
 
AWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in aws
AWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in awsAWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in aws
AWS Technical Day Riyadh Nov 2019 - Scaling threat detection and response in aws
AWS Riyadh User Group
 
AWS Technical Day Riyadh Nov 2019 [Migration]
AWS Technical Day Riyadh Nov 2019 [Migration]AWS Technical Day Riyadh Nov 2019 [Migration]
AWS Technical Day Riyadh Nov 2019 [Migration]
AWS Riyadh User Group
 
Amazon Virtual Private Cloud - VPC 2
Amazon Virtual Private Cloud - VPC 2Amazon Virtual Private Cloud - VPC 2
Amazon Virtual Private Cloud - VPC 2
AWS Riyadh User Group
 
Amazon Virtual Private Cloud - VPC 1
Amazon Virtual Private Cloud - VPC 1Amazon Virtual Private Cloud - VPC 1
Amazon Virtual Private Cloud - VPC 1
AWS Riyadh User Group
 
Amazon relational database service (rds)
Amazon relational database service (rds)Amazon relational database service (rds)
Amazon relational database service (rds)
AWS Riyadh User Group
 
Ad

Recently uploaded (20)

Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Ad

Demistifying serverless on aws

  • 2. Ahmed Samir Solution Architect Associate Technical Architect – Banking Sector 12 years experience in IT Field Development Background in Microsoft stack Organize Cloud Communities in Riyadh /in/aseldesouky/ aseldesouky AWSbelaraby AWSbelaraby #AWS_‫بالعربي‬ http://bit.ly/2vbnFH4
  • 3. Agenda • How we got to where we are? • What's Serverless • Serverless Principles • Pros and cons • Serverless architectures • Lambda Anatomy • Demos • AWS SAM • Demo
  • 4. How we got to where we are?
  • 5. Microservices SOA Monolithic Design Services are built in small units and expressed formally with business-oriented APIs. Services can range in size anywhere from small application services to very large enterprise services including much more business functionality. Monolithic applications evolve into huge size, a situation where understanding the entirety of the application is difficult. Usability Services exposed with a standard protocol, such as a RESTful API, and consumed/reused by other services and applications. Services exposed with a standard protocol, such as SOAP and consumed/reused by other services – leverage messaging middleware. Limited re-use is realized across monolithic applications. Scalability Services exist as independent deployment artifacts and can be scaled independently of other services. Dependencies between services and reusable sub-components can introduce scaling challenges. Scaling monolithic applications can often be a challenge. Agility Smaller independent deployable units ease build/release management, thereby high operational agility. Enhances components sharing that increases dependencies and limits management capabilities. Difficult to achieve operational agility in the repeated deployment of monolithic application artifacts. Development Developing services discretely allows developers to use the appropriate development framework for the task at hand. Reusable components and standard practices helps developers with implementation. Monolithic applications are implemented using a single development stack (i.e., JEE or .NET), which can limit the availability of “the right tool for the job”.
  • 6. XaaS Infrastructure as a Service (IaaS) Software as a Service (SaaS) Platform as a Service (PaaS) Container as a Service (CaaS) Function as a Service (FaaS) base infrastructure (Virtual machine, Software Define Network, Storage attached) AWS (EC2), Azure VMmanaged by vendors: applications, runtime, data, middleware, OSes, virtualization, servers, storage and networking, End users have to use it Gmail, SAP, SalesforceIt provides a platform allowing end user to develop, run, and manage applications without the complexity of building and maintaining the infrastructure AWS (Beanstalk) container-based virtualization in which container engines, orchestration and the underlying compute resources are delivered to users as a service from a cloud providerAWS (ECS), Azure (ACS) It provides a platform allowing customers to develop, run, and manage application functionalities without the complexity of building and maintaining the infrastructure AWS Lambda
  • 8. Serverless • Focus entirely on the business logic of your applications. • You don't have to think about servers, provisioned infrastructure, networking, virtual machine etc. • All this stuff is handled for you by a cloud provider (AWS in case o Lambda). • Usually it means, that your application heavily relies on managed services (like Lambda, DynamoDB, API Gateway) that are maintained by a cloud provider and allow you to abstract the server away
  • 10. • Use a compute service to execute code on demand (no servers) • Write single-purpose stateless functions • Design push-based, event-driven pipelines • Create thicker, more powerful front ends. • Embrace third-party services Serverless Principles
  • 12. • Greater Agility • Less Operations • Faster time to market • Cost growth with your business • Simplifies packaging and deployment and requires no system administration. • Reduces the complexity of software. • Fits with microservices, which can be implemented as functions.
  • 13. • Serverless is not efficient for long-running applications • Vendor lock-in • Serverless (and microservice) architectures introduce additional overhead for function/microservice calls. • To utilize its resources more efficiently, a service provider may run software for several different customers on the same physical server (this is also known as “multitenancy”) • In practice, it takes some time for a scalable serverless platform to handle a first request by your function – Cold Start
  • 15. •No More Servers •Startups that want to innovate and move quickly •Low and expected cost •Less Code •Scalable And Flexible
  • 17. Compute as backend an approach where a serverless compute service such as Lambda and third-party services are used to build a back end for web, mobile, and desktop applications The front-end can links directly to the database and an authentication service. This is because there’s no need to put every service behind an API Gateway if the front end can communicate with them in a secure manner for example, using delegation tokens;
  • 21. A Cloud Guru Architecture details • The front end is built using AngularJS and is hosted by Netlify. You could use S3 and CloudFront (CloudFront is a global content delivery network provided by AWS) instead of Netlify if you wanted to • Auth0 is used to provide registration and authentication facilities. It creates delegation tokens that allow the front end to directly and securely communicate with other services such as Firebase. • Firebase is the real-time database used by A Cloud Guru. Every client creates a connection to Firebase using web sockets and receives updates from it in near real time. This means that clients receive updates as they happen without having to poll.
  • 22. A Cloud Guru Architecture details • Lecturers who create content for the platform can upload files (usually videos, but they could be other types) straight to S3 buckets via their browser. For this to work, the web application invokes a Lambda function (via the API Gateway) to request the necessary upload credentials first. As soon as credentials are retrieved, the client web application begins a file upload to S3 via HTTP. All of this happens behind the scenes and is opaque to the user
  • 23. A Cloud Guru Architecture details • Once a file is uploaded to S3, it automatically kicks off a chain of events (event-driven pipeline) that transcodes the video, saves new files in another bucket, updates the database, and immediately makes transcoded videos available to other users. Throughout this book you’ll write a similar system and see how it works in detail. • To view videos, users are given permission by another Lambda function. Permissions are valid for 24 hours, after which they must be renewed. Files are accessed via CloudFront.
  • 24. A Cloud Guru Architecture details • Users can submit questions and answers to the forums. Questions, answers, and comments are recorded in the database. This data is then sent for indexing to AWS CloudSearch, which is a managed searching and indexing service from AWS. This allows users to search and view questions, answers, and comments that other people have written
  • 25. Legacy API proxy • Systems with outdated services and APIs can be difficult to use in modern environments. • They might not conform to modern protocols or standards, which might make interoperability with current systems harder. • One way to alleviate this problem is to use the API Gateway and Lambda in front of those legacy services. • The API Gateway and Lambda functions can transform requests made by clients and invoke legacy services directly
  • 27. Hybrid • The hybrid approach may work especially well if a part of the existing infrastructure is already in AWS. • We’ve also seen adoption of serverless technologies and architectures in organizations with developers initially creating standalone components (often to do additional data processing, database backups, and basic alerting) and over time integrating these components into their main systems
  • 29. GraphQL • Popular data query language developed by Facebook in 2012 and released publicly in 2015. • It was designed as an alternative to REST (Representational State Transfer) because of REST’s perceived weaknesses (multiple round-trips, over-fetching, and problems with versioning). • GraphQL attempts to solve these problems by providing a hierarchical, declarative way of performing queries from a single end point
  • 31. Compute as glue we can use Lambda functions to create powerful execution pipelines and workflows. This often involves using Lambda as glue between different services, coordinating and invoking them. With this style of architecture, the focus of the developer is on the design of their pipeline, coordination, and flow of data.
  • 33. Real-time processing Amazon Kinesis Streams is a technology that can help process and analyze large amounts of streaming data. This data can include logs, events, transactions, social media feeds—virtually anything you can think of It’s a good way to continuously collect data that may change over time. Lambda is a perfect tool for Kinesis Streams because it scales automatically in response to how much data there is to process
  • 35. Serverless Architectures 1. Compute as back end 2. Compute as glue 3. Legacy API wrapper 4. Hybrid 5. GraphQL 6. Real-time processing
  • 37. Lambda can be described as Function as a Service (FaaS), where the functions is the main building block and execution unit. No servers to manage, no virtual machines, clusters, containers, just a function created in one of the supported languages As with any other managed service, provisioning, scaling and reliability is handled automatically by AWS. This allows us to work on a very high abstraction level, focus entirely on the business logic and (almost) forget about underlying resources.
  • 38. Lambda Runtimes Node.js 10 Node.js 12 Python 3.8 Python 3.7 Python 3.6 Python 2.7 Ruby 2.5 Java 8 Java 11 Go 1.x.NET Core 2.1
  • 41. Event provides function with the detailed information about the event that has triggered the execution (for example, Event from API Gateway can be used to retrieve request details such as query parameters, header or even request body) Context on the other hand, contains methods and properties that provide information about the invocation, function, and execution environment (such as assigned memory limit or upcoming execution timeout).
  • 43. Cold Start 1. Download your code 2. Set up a runtime environment, together with the resources specified in the Lambda configuration The exact length of the Cold Start varies, depending on your code package size and settings For that reason it's wise to keep you code package size as small as possible Take care of node_modules size First Time o idle for a longer period of time
  • 44. Warm Start after handler execution. For some time, the runtime remains active and can receive new events Warm execution is of course much faster than the cold one we cannot assume that the function will, or will not be called with a cold or warm start The time for which the function stays warm is not precisely defined in the documentation and is actually based on your configuration and actual Lambda usage If such event occurs, the warm runtime does not have to be initialized again, it can execute the handler immediately If you allow concurrency of your Lambdas, newly created Lambda instances will also start with a cold start.
  • 45. Initialization vs handler it's recommended, to store all the initialization code outside of the handler function. All the initialization (like creating database connection), should be done outside of handler and just used inside it.
  • 46. ScalingAuto scaling of Lambda functions is handled automatically by Lambda service. By default, Lambda is trying to handle incoming invocation requests by reusing the existing warm runtimes. This works if the function execution time is shorter then the time between upcoming requests if the time between the events is < the function execution time, the single function instance is not able to handle those invocation requests.
  • 47. ScalingAuto scaling of Lambda functions is handled automatically by Lambda service. If Lambda receives a new invocation request while all the current runtimes are busy, it will create another runtime. This new runtime will handle the upcoming invocation request and execute the function code. Then runtime remains in the warm state for some time and can receive new requests. If the runtime stays idle for a longer period of time, Lambda terminates it to free the resources.
  • 49. Lambda invocation flow The invocation request is passed by Load Balancer to a selected Frontend Invoker, Frontend Invoker checks the request, and asks the Worker Manager for a sandboxed function that will handle the invocation. Worker Manager either finds a proper Worker and a sandbox, or creates one. Once it's ready, the code is executed by a Worker
  • 50. Isolation The technology that powers this flow is Firecracker. It's an open source (link) project that allows AWS to span hundreds and thousands lightweight sandboxes on a single Worker. https://firecracker-microvm.github.io/ Workers can be reused across multiple Lambdas and even Accounts, which allows the Placement Service to organize the work to create and apply the most performant usage patterns as possible.
  • 51. Pricing – By Region
  • 52. Pricing – Example If you allocated 512MB of memory to your function, executed it 3 million times in one month, and it ran for 1 second each time, your charges would be calculated as follows: https://aws.amazon.com/lambda/pricing/ http://serverlesscalc.com/
  • 55. Demo
  • 75. Demo