SlideShare ist ein Scribd-Unternehmen logo
1 von 52
AWS Serverless
concepts and solutions
Agenda
1. AWS Serverless concepts
2. Serverless in the framework of business
3. AWS Serverless architectural approaches
4. AWS Lambdas overview and deployment models
5. Infrastructure as Code in AWS Serverless
6. CI/CD for AWS Serverless applications
7. AWS Serverless practical aspects
8. AWS Lambda monitoring and pitfalls
About me
Education:
Kharkiv National University of radio-electronics
Work experience:
3 years of software development expertise (full stack)
1 year of expertise in data engineering
Hobbies:
Cookery, cycling, skiing, painting
AWS Serverless
concepts
Serverless computing
 Dynamic resources allocation
 Stateless containers
 Various events as triggers
 "Functions as a Service"
Serverless advantages
Paying for value Reliability and fault tolerance
No servers to provision Scaling with usage
Serverless applications
Java
Python
Node.js
C#
Go
Ruby
Runtime API
- Changes in
data state
- Requests
to endpoints
- Changes in
resource state
Business aspects
of Serverless
Business benefits
Shorter time to
market
Increased
efficiency
Fixed costs
become variable
costs
Less waste More flexibility
Better service
stability
Better
management of
development
and testing
Serverless use cases
Web apps and back-end API Data processing and analytics
Internet of thingsChat bots
Third-party integrations
Internal tooling
Serverless side-effects
Vendor
lock-in
Service Level
Agreements
Maintaining
many small
services
Slower
service start &
higher latency
AWS Serverless
architectures
Serverless architectures
S3
bucket
Object
Lambda
function
1. File put into
S3 bucket
2. Lambda
invoked
Serverless architectures
SNS
topic
Lambda
function
Data
1. Data published
to a topic
2. Lambda
invoked
Serverless architectures
Message Amazon
SQS
Lambda
function
2. Lambda
polls queue
and invokes
function
1. Message
inserted to a queue
3. Function
removes
message from
queue
Serverless architectures
CloudWatch
events
(time-based)
Lambda
function
1. Scheduled time
occurs
2. Lambda
invoked
Serverless architectures
Amazon
Kinesis
Data
Stream
Lambda
function
2. Lambda
polls stream
1. Data published
to a stream
3. Amazon
Kinesis returns
stream data
Data
AWS Lambda
overview
AWS Lambda
 Concept to run the code
without provisioning or
managing servers
 Virtually supporting any
type of application or back-
end service – with zero
administration
 Resource allocation on
demand which ensures cost-
effectiveness
Lambda function anatomy
Handler function
function to be executed
upon invocation
Event object
data sent during
function invocation
Context object
contains runtime
information
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class LambdaFunction implements RequestHandler<Object, Object> {
@Override
public Object handleRequest(Object obj, Context context) {
// TODO implement
context.getLogger().log("Hello Lambda Function!");
return null;
}
}
Lambda lifecycle
Deployment
(code uploaded)
Trigger by
event
Container with
code created
Code execution
Re-launching or
container destruction
AWS Lambda config
and deployment
AWS Serverless Application Model
 Open-source framework for
building serverless applications
 Simple and clean syntax
 Lambda-like execution env for
local development
 Applications are defined by SAM
templates (yaml)
 Transforms SAM templates into
AWS CloudFormation syntax
AWS CloudFormation
 Service to model and set up AWS
resources
 Simplify infrastructure management
 Quick replication of infrastructure
 Easily control and track changes to
infrastructure
 Templates in json or yaml transform
into stacks
 Changes in stacks are tracked by
change sets
Lambda with AWS SAM
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description : Sample SAM Template for sam-app
Globals:
Function:
Timeout: 20
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
Handler: helloworld.LambdaFunction::handleRequest
Runtime: java8
Environment:
Variables:
PARAM1: VALUE
sam build && sam local invoke --event event.json
sam deploy --guided
Lambda with AWS CloudFormation
AWSTemplateFormatVersion: "2010-09-09"
Description: Lambda template
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: test-function
Handler: helloworld.LambdaFunction
Role: !Sub arn:aws:iam::${AWS::Accounted}:role/lambda-role
Code:
S3Bucket: test-bucket
S3Key: SamApp-1.0.jar
Runtime: java8
Timeout: 60
MemorySize: 256
# Build artifact
mvn clean package
# Create S3 bucket for artifacts
aws s3 mb s3://test-bucket --region us-east-1
# Upload artifact to S3 bucket
aws s3 cp ./target/SamApp-1.0.jar s3://test-bucket
# Deploy Lambda template to AWS
aws cloudformation deploy --stack-name test-lambda 
--template-file ./stack-lambda.yaml --capabilities CAPABILITY_NAMED_IAM
Serverless Application Model vs CloudFormation
SAM CloudFormation
Template format Yaml Yaml and json
Concept Framework as
CloudFormation extension
Service to manage
resources
Deployment Template is transformed
into CloudFormation one
and deployed into stack
Stack is the result of
template deployment
Function definition Function is defined by
AWS::Serverless::Function
Function is defined by
AWS::Lambda::Function
Local development Provides local lambda-like
environment
Doesn’t provide local
development features
API SAM API AWS SDK API for
CloudFormation
Supported resources Limited list of supported
resources
Extended list of supported
resources
Purpose Serverless applications Complete infrastructure
Infrastructure
as Code
Infrastructure as Code
Provisioning and managing
cloud resources by writing a
template file that is both
human readable, and machine
consumable
For AWS cloud
development the built-in
choice for infrastructure
as code is AWS
CloudFormation
AWSTemplateFormatVersion: "2010-09-09"
Description: Example Stack
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: test-function
Handler: helloworld.LambdaFunction
Role:
Fn::ImportValue: lambda-role
Code:
S3Bucket: test-bucket
S3Key: SamApp-1.0.jar
Runtime: java8
PermissionLambda:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !GetAtt LambdaFunction.Arn
Action: lambda:InvokeFunction
Principal: sns.amazonaws.com
SourceArn: !Ref SnsTopic
SnsTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: sns-topic
Subscription:
- Endpoint: !GetAtt LambdaFunction.Arn
Protocol: lambda
Infrastructure as Code
Benefits of Infrastructure as Code
VISIBILITY STABILITY SCALABILITY
SECURITY TRANSACTIONAL
CI/CD in Serverless
CI/CD in Serverless Applications
AWS CodeCommit
source control service
AWS CodeBuild
continuous integration service
AWS CodeDeploy
deployment service
AWS CodePipeline
 Release pipelines for fast and reliable application and infrastructure updates
 Automates the build, test, and deploy phases
 Rapid and reliable features and updates delivery
 Integration with third-party services such as GitHub or with the custom plugins
Build
specification
for AWS
CodeBuild
version: 0.2
env:
variables:
JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64
phases:
install:
commands:
- echo Entered the install phase...
- apt-get update -y
- apt-get install -y maven
finally:
- echo Install phase completed
pre_build:
commands:
- echo Entered the pre_build phase...
- cd test-app
finally:
- echo Pre-build phase completed
build:
commands:
- echo Entered the build phase...
- echo Build started on `date`
- mvn install
finally:
- echo Build phase completed
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- target/test-app-1.0.jar
discard-paths: yes
CodePipeline template
AWSTemplateFormatVersion: "2010-09-09"
Description: AWS Code Build Project Stack
Resources:
CodePipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
…
Stages:
- Name: Source
Actions:
- Name: SourceAction
…
- Name: Build
Actions:
- Name: BuildAction
…
- Name: Deploy
Actions:
- Name: DeployAction
…
CodeBuild template
AWSTemplateFormatVersion: "2010-09-09"
Description: AWS Code Build Project Stack
Resources:
CodeBuildProject:
Type: AWS::CodeBuild::Project
Properties:
Name: "code-build-project"
ServiceRole:
Fn::ImportValue: "code-build-service-role"
Artifacts:
Type: CODEPIPELINE
Environment:
Type: LINUX_CONTAINER
ComputeType: BUILD_GENERAL1_SMALL
Image: aws/codebuild/standard:1.0
Source:
Type: CODEPIPELINE
CodePipeline Webhook
CodePipelineWebhook:
Type: AWS::CodePipeline::Webhook
Properties:
Authentication: GITHUB_HMAC
AuthenticationConfiguration:
SecretToken: '{{resolve:ssm:gitHubToken:1}}'
Filters:
- JsonPath: "$.ref"
MatchEquals: "refs/heads/{Branch}"
- JsonPath: "$.commits[*].modified[*]"
MatchEquals: !Ref FileModified
Name: "code-pipeline-webhook"
RegisterWithThirdParty: true
TargetAction: SourceAction
TargetPipeline: !Ref CodePipeline
TargetPipelineVersion: !GetAtt CodePipeline.Version
Lambda deployment unified approach
LAMBDA_HANDLER_VENDOR=$(LAMBDA_HANDLER_BATCH_$(VENDOR))
# Deploy Lambda template to AWS
aws cloudformation deploy --no-fail-on-empty-changeset 
--stack-name $(STACK_LAMBDA_BATCH_METRICS_VENDOR) 
--template-file ./lambda-
app/target/classes/$(TEMPLATE_LAMBDA_BATCH_METRICS) 
--parameter-overrides "Environment=$(ENV_KEY)" 
"DataSourceSuffix=$(SUFFIX_DATA_SOURCE_VENDOR)" 
"LambdaHandler=$(LAMBDA_HANDLER_VENDOR)" 
"LambdaFunctionName=$(FUNCTION_VENDOR)" 
"LambdaScheduleExpression=rate(1 hour)" 
--capabilities CAPABILITY_NAMED_IAM
Parameters are defined in separate Makefiles configured
for each vendor separately.
Vendor key is passed as parameter to command.
AWS Serverless
in practice
Serverless web application with API Gateway
Amazon S3
API Gateway AWS Lambda
Amazon
CloudFront
Amazon S3 stores all
the static content
API Gateway handles all
the application routing
Lambda runs all the
back-end logic
CloudFront acts as CDN and
is typically used to front this
Serverless web application with API Gateway
AWS Data Pipeline AWS Lambda
Amazon S3 acts as
a storage for new
coming data
AWS Data Pipeline
ingests new data by
scheduled interval
Lambda performs final
processing on the data
Third-party data
providers
Third-party data
providers push data to
the respective bucket
Amazon S3
CloudWatch events
(time-based)
Amazon Redshift
Final data storage
Grafana
(visualization)
Monitoring and
extra cases
Lambda monitoring
Lambda monitoring
Lambda monitoring
Lambda cold start
What is a cold start?
 When running a serverless function, it will stay active (hot) as long as
you're running it
 After a period of inactivity, your cloud provider will drop the
container, and your function will become inactive (cold)
 A cold start happens when you execute an inactive function. The
delay comes from your cloud provider provisioning your selected
runtime container and then running your function
 This process will considerably increase your execution time
!!! Provisioning of the function's container can take > 5 seconds.
That makes it impossible to guarantee < 1 second latency.
Lambda warm-up
How to keep Lambda warm?
 Create scheduled event to invoke Lambda in configured time interval
to keep the force the container to stay alive
 In case of Serverless Framework there’s serverless-plugin-warmup
which provides a possibility to keep Lambda warm
!!! Containers are not reused after ~ 15 minutes of inactivity.
Knowing the system features will help to answer the question
whether the warmup is needed.
Lambda pitfalls
Lambda function not invoked by service:
Lambda permissions must be configured to allow invocations
by certain service
Function fails by timeout or memory lack:
Timeout and MemorySize settings should be explicitly stated.
In most cases it’s better to increase Memory Size
Exception occurs during the call inside the function:
In case Lambda performs access to a service, there should be
related permissions configured in Lambda role
Logs don’t appear in CloudWatch:
Function needs permissions to call CloudWatch Logs.
Execution role has to be updated to grant the latter
Summary
 Serverless approach allows to pay for usage and save the money
 Fits to suitable business cases where no dedicated servers are required
 Serverless is suitable in case service can be encapsulated in single function
 No provisioning and maintenance from your side
 Easy local development and testing
 Wide range of AWS tools to build Serverless applications
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Let's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS LambdaLet's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS LambdaOkis Chuang
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaAmazon Web Services
 
Serverless Architectures on AWS Lambda
Serverless Architectures on AWS LambdaServerless Architectures on AWS Lambda
Serverless Architectures on AWS LambdaSerhat Can
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless ArchitectureElana Krasner
 
Building Serverless Web Applications - May 2017 AWS Online Tech Talks
Building Serverless Web Applications  - May 2017 AWS Online Tech TalksBuilding Serverless Web Applications  - May 2017 AWS Online Tech Talks
Building Serverless Web Applications - May 2017 AWS Online Tech TalksAmazon Web Services
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaAmazon Web Services
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesAmazon Web Services
 
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...Amazon Web Services
 
Serverless Architecture on AWS
Serverless Architecture on AWSServerless Architecture on AWS
Serverless Architecture on AWSRajind Ruparathna
 
AWS Lambda: Event-driven Code for Devices and the Cloud
AWS Lambda: Event-driven Code for Devices and the CloudAWS Lambda: Event-driven Code for Devices and the Cloud
AWS Lambda: Event-driven Code for Devices and the CloudAmazon Web Services
 
What is AWS lambda?
What is AWS lambda?What is AWS lambda?
What is AWS lambda?Whizlabs
 
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...Amazon Web Services
 
Serverless Application Development with SAM
Serverless Application Development with SAMServerless Application Development with SAM
Serverless Application Development with SAMAmazon Web Services
 
Using AWS Lambda to Build Control Systems for Your AWS Infrastructure
Using AWS Lambda to Build Control Systems for Your AWS InfrastructureUsing AWS Lambda to Build Control Systems for Your AWS Infrastructure
Using AWS Lambda to Build Control Systems for Your AWS InfrastructureAmazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Deep dive on Serverless application development
Deep dive on Serverless application developmentDeep dive on Serverless application development
Deep dive on Serverless application developmentAmazon Web Services
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to ServerlessNikolaus Graf
 
NEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# ApplicationsNEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# ApplicationsAmazon Web Services
 

Was ist angesagt? (20)

Let's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS LambdaLet's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS Lambda
 
AWS Introduction
AWS IntroductionAWS Introduction
AWS Introduction
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS Lambda
 
Serverless Architectures on AWS Lambda
Serverless Architectures on AWS LambdaServerless Architectures on AWS Lambda
Serverless Architectures on AWS Lambda
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
Building Serverless Web Applications - May 2017 AWS Online Tech Talks
Building Serverless Web Applications  - May 2017 AWS Online Tech TalksBuilding Serverless Web Applications  - May 2017 AWS Online Tech Talks
Building Serverless Web Applications - May 2017 AWS Online Tech Talks
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS Lambda
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
 
Serverless Architecture on AWS
Serverless Architecture on AWSServerless Architecture on AWS
Serverless Architecture on AWS
 
AWS Lambda: Event-driven Code for Devices and the Cloud
AWS Lambda: Event-driven Code for Devices and the CloudAWS Lambda: Event-driven Code for Devices and the Cloud
AWS Lambda: Event-driven Code for Devices and the Cloud
 
What is AWS lambda?
What is AWS lambda?What is AWS lambda?
What is AWS lambda?
 
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
 
Serverless Application Development with SAM
Serverless Application Development with SAMServerless Application Development with SAM
Serverless Application Development with SAM
 
Using AWS Lambda to Build Control Systems for Your AWS Infrastructure
Using AWS Lambda to Build Control Systems for Your AWS InfrastructureUsing AWS Lambda to Build Control Systems for Your AWS Infrastructure
Using AWS Lambda to Build Control Systems for Your AWS Infrastructure
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Deep dive on Serverless application development
Deep dive on Serverless application developmentDeep dive on Serverless application development
Deep dive on Serverless application development
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
AWS Lambda in C#
AWS Lambda in C#AWS Lambda in C#
AWS Lambda in C#
 
NEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# ApplicationsNEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# Applications
 

Ähnlich wie AWS Serverless concepts and solutions

Application Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldApplication Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldAmazon Web Services
 
muCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsmuCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsChris Munns
 
Deep Dive on Serverless Application Development NY Loft
Deep Dive on Serverless Application Development NY LoftDeep Dive on Serverless Application Development NY Loft
Deep Dive on Serverless Application Development NY LoftAmazon Web Services
 
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017Amazon Web Services
 
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...Cloud Native Day Tel Aviv
 
SMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsSMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsAmazon Web Services
 
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017Amazon Web Services
 
Raleigh DevDay 2017: Building CICD pipelines for serverless applications
Raleigh DevDay 2017: Building CICD pipelines for serverless applicationsRaleigh DevDay 2017: Building CICD pipelines for serverless applications
Raleigh DevDay 2017: Building CICD pipelines for serverless applicationsAmazon Web Services
 
SRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application DevelopmentSRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application DevelopmentAmazon Web Services
 
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudSRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018Amazon Web Services
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Amazon Web Services
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Amazon Web Services
 
Raleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsRaleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsAmazon Web Services
 
re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda Amazon Web Services
 
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)Amazon Web Services
 
Twelve Factor Serverless Applications
Twelve Factor Serverless ApplicationsTwelve Factor Serverless Applications
Twelve Factor Serverless ApplicationsAmazon Web Services
 
DevOps on AWS - Accelerating Software Delivery
DevOps on AWS - Accelerating Software DeliveryDevOps on AWS - Accelerating Software Delivery
DevOps on AWS - Accelerating Software DeliveryAmazon Web Services
 

Ähnlich wie AWS Serverless concepts and solutions (20)

Deep Dive on Serverless Stack
Deep Dive on Serverless StackDeep Dive on Serverless Stack
Deep Dive on Serverless Stack
 
Application Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldApplication Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless World
 
muCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsmuCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless Applications
 
Deep Dive on Serverless Application Development NY Loft
Deep Dive on Serverless Application Development NY LoftDeep Dive on Serverless Application Development NY Loft
Deep Dive on Serverless Application Development NY Loft
 
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
Building CICD Pipelines for Serverless Applications - DevDay Austin 2017
 
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
 
SMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsSMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless Applications
 
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
 
Raleigh DevDay 2017: Building CICD pipelines for serverless applications
Raleigh DevDay 2017: Building CICD pipelines for serverless applicationsRaleigh DevDay 2017: Building CICD pipelines for serverless applications
Raleigh DevDay 2017: Building CICD pipelines for serverless applications
 
SRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application DevelopmentSRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application Development
 
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudSRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
 
How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018How to build and deploy serverless apps - AWS Summit Cape Town 2018
How to build and deploy serverless apps - AWS Summit Cape Town 2018
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
 
Introduction to DevOps on AWS
Introduction to DevOps on AWSIntroduction to DevOps on AWS
Introduction to DevOps on AWS
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
 
Raleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsRaleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applications
 
re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda
 
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
 
Twelve Factor Serverless Applications
Twelve Factor Serverless ApplicationsTwelve Factor Serverless Applications
Twelve Factor Serverless Applications
 
DevOps on AWS - Accelerating Software Delivery
DevOps on AWS - Accelerating Software DeliveryDevOps on AWS - Accelerating Software Delivery
DevOps on AWS - Accelerating Software Delivery
 

Kürzlich hochgeladen

UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 

Kürzlich hochgeladen (20)

UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 

AWS Serverless concepts and solutions

  • 2. Agenda 1. AWS Serverless concepts 2. Serverless in the framework of business 3. AWS Serverless architectural approaches 4. AWS Lambdas overview and deployment models 5. Infrastructure as Code in AWS Serverless 6. CI/CD for AWS Serverless applications 7. AWS Serverless practical aspects 8. AWS Lambda monitoring and pitfalls
  • 3. About me Education: Kharkiv National University of radio-electronics Work experience: 3 years of software development expertise (full stack) 1 year of expertise in data engineering Hobbies: Cookery, cycling, skiing, painting
  • 5. Serverless computing  Dynamic resources allocation  Stateless containers  Various events as triggers  "Functions as a Service"
  • 6. Serverless advantages Paying for value Reliability and fault tolerance No servers to provision Scaling with usage
  • 7.
  • 8. Serverless applications Java Python Node.js C# Go Ruby Runtime API - Changes in data state - Requests to endpoints - Changes in resource state
  • 10. Business benefits Shorter time to market Increased efficiency Fixed costs become variable costs Less waste More flexibility Better service stability Better management of development and testing
  • 11. Serverless use cases Web apps and back-end API Data processing and analytics Internet of thingsChat bots Third-party integrations Internal tooling
  • 12. Serverless side-effects Vendor lock-in Service Level Agreements Maintaining many small services Slower service start & higher latency
  • 15. Serverless architectures SNS topic Lambda function Data 1. Data published to a topic 2. Lambda invoked
  • 16. Serverless architectures Message Amazon SQS Lambda function 2. Lambda polls queue and invokes function 1. Message inserted to a queue 3. Function removes message from queue
  • 18. Serverless architectures Amazon Kinesis Data Stream Lambda function 2. Lambda polls stream 1. Data published to a stream 3. Amazon Kinesis returns stream data Data
  • 20. AWS Lambda  Concept to run the code without provisioning or managing servers  Virtually supporting any type of application or back- end service – with zero administration  Resource allocation on demand which ensures cost- effectiveness
  • 21. Lambda function anatomy Handler function function to be executed upon invocation Event object data sent during function invocation Context object contains runtime information import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; public class LambdaFunction implements RequestHandler<Object, Object> { @Override public Object handleRequest(Object obj, Context context) { // TODO implement context.getLogger().log("Hello Lambda Function!"); return null; } }
  • 22. Lambda lifecycle Deployment (code uploaded) Trigger by event Container with code created Code execution Re-launching or container destruction
  • 23. AWS Lambda config and deployment
  • 24. AWS Serverless Application Model  Open-source framework for building serverless applications  Simple and clean syntax  Lambda-like execution env for local development  Applications are defined by SAM templates (yaml)  Transforms SAM templates into AWS CloudFormation syntax
  • 25. AWS CloudFormation  Service to model and set up AWS resources  Simplify infrastructure management  Quick replication of infrastructure  Easily control and track changes to infrastructure  Templates in json or yaml transform into stacks  Changes in stacks are tracked by change sets
  • 26. Lambda with AWS SAM AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description : Sample SAM Template for sam-app Globals: Function: Timeout: 20 Resources: HelloWorldFunction: Type: AWS::Serverless::Function Properties: Handler: helloworld.LambdaFunction::handleRequest Runtime: java8 Environment: Variables: PARAM1: VALUE sam build && sam local invoke --event event.json sam deploy --guided
  • 27. Lambda with AWS CloudFormation AWSTemplateFormatVersion: "2010-09-09" Description: Lambda template Resources: LambdaFunction: Type: AWS::Lambda::Function Properties: FunctionName: test-function Handler: helloworld.LambdaFunction Role: !Sub arn:aws:iam::${AWS::Accounted}:role/lambda-role Code: S3Bucket: test-bucket S3Key: SamApp-1.0.jar Runtime: java8 Timeout: 60 MemorySize: 256 # Build artifact mvn clean package # Create S3 bucket for artifacts aws s3 mb s3://test-bucket --region us-east-1 # Upload artifact to S3 bucket aws s3 cp ./target/SamApp-1.0.jar s3://test-bucket # Deploy Lambda template to AWS aws cloudformation deploy --stack-name test-lambda --template-file ./stack-lambda.yaml --capabilities CAPABILITY_NAMED_IAM
  • 28. Serverless Application Model vs CloudFormation SAM CloudFormation Template format Yaml Yaml and json Concept Framework as CloudFormation extension Service to manage resources Deployment Template is transformed into CloudFormation one and deployed into stack Stack is the result of template deployment Function definition Function is defined by AWS::Serverless::Function Function is defined by AWS::Lambda::Function Local development Provides local lambda-like environment Doesn’t provide local development features API SAM API AWS SDK API for CloudFormation Supported resources Limited list of supported resources Extended list of supported resources Purpose Serverless applications Complete infrastructure
  • 30. Infrastructure as Code Provisioning and managing cloud resources by writing a template file that is both human readable, and machine consumable For AWS cloud development the built-in choice for infrastructure as code is AWS CloudFormation
  • 31. AWSTemplateFormatVersion: "2010-09-09" Description: Example Stack Resources: LambdaFunction: Type: AWS::Lambda::Function Properties: FunctionName: test-function Handler: helloworld.LambdaFunction Role: Fn::ImportValue: lambda-role Code: S3Bucket: test-bucket S3Key: SamApp-1.0.jar Runtime: java8 PermissionLambda: Type: AWS::Lambda::Permission Properties: FunctionName: !GetAtt LambdaFunction.Arn Action: lambda:InvokeFunction Principal: sns.amazonaws.com SourceArn: !Ref SnsTopic SnsTopic: Type: AWS::SNS::Topic Properties: TopicName: sns-topic Subscription: - Endpoint: !GetAtt LambdaFunction.Arn Protocol: lambda Infrastructure as Code
  • 32. Benefits of Infrastructure as Code VISIBILITY STABILITY SCALABILITY SECURITY TRANSACTIONAL
  • 34. CI/CD in Serverless Applications AWS CodeCommit source control service AWS CodeBuild continuous integration service AWS CodeDeploy deployment service
  • 35. AWS CodePipeline  Release pipelines for fast and reliable application and infrastructure updates  Automates the build, test, and deploy phases  Rapid and reliable features and updates delivery  Integration with third-party services such as GitHub or with the custom plugins
  • 36. Build specification for AWS CodeBuild version: 0.2 env: variables: JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64 phases: install: commands: - echo Entered the install phase... - apt-get update -y - apt-get install -y maven finally: - echo Install phase completed pre_build: commands: - echo Entered the pre_build phase... - cd test-app finally: - echo Pre-build phase completed build: commands: - echo Entered the build phase... - echo Build started on `date` - mvn install finally: - echo Build phase completed post_build: commands: - echo Build completed on `date` artifacts: files: - target/test-app-1.0.jar discard-paths: yes
  • 37.
  • 38. CodePipeline template AWSTemplateFormatVersion: "2010-09-09" Description: AWS Code Build Project Stack Resources: CodePipeline: Type: AWS::CodePipeline::Pipeline Properties: … Stages: - Name: Source Actions: - Name: SourceAction … - Name: Build Actions: - Name: BuildAction … - Name: Deploy Actions: - Name: DeployAction …
  • 39. CodeBuild template AWSTemplateFormatVersion: "2010-09-09" Description: AWS Code Build Project Stack Resources: CodeBuildProject: Type: AWS::CodeBuild::Project Properties: Name: "code-build-project" ServiceRole: Fn::ImportValue: "code-build-service-role" Artifacts: Type: CODEPIPELINE Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL Image: aws/codebuild/standard:1.0 Source: Type: CODEPIPELINE
  • 40. CodePipeline Webhook CodePipelineWebhook: Type: AWS::CodePipeline::Webhook Properties: Authentication: GITHUB_HMAC AuthenticationConfiguration: SecretToken: '{{resolve:ssm:gitHubToken:1}}' Filters: - JsonPath: "$.ref" MatchEquals: "refs/heads/{Branch}" - JsonPath: "$.commits[*].modified[*]" MatchEquals: !Ref FileModified Name: "code-pipeline-webhook" RegisterWithThirdParty: true TargetAction: SourceAction TargetPipeline: !Ref CodePipeline TargetPipelineVersion: !GetAtt CodePipeline.Version
  • 41. Lambda deployment unified approach LAMBDA_HANDLER_VENDOR=$(LAMBDA_HANDLER_BATCH_$(VENDOR)) # Deploy Lambda template to AWS aws cloudformation deploy --no-fail-on-empty-changeset --stack-name $(STACK_LAMBDA_BATCH_METRICS_VENDOR) --template-file ./lambda- app/target/classes/$(TEMPLATE_LAMBDA_BATCH_METRICS) --parameter-overrides "Environment=$(ENV_KEY)" "DataSourceSuffix=$(SUFFIX_DATA_SOURCE_VENDOR)" "LambdaHandler=$(LAMBDA_HANDLER_VENDOR)" "LambdaFunctionName=$(FUNCTION_VENDOR)" "LambdaScheduleExpression=rate(1 hour)" --capabilities CAPABILITY_NAMED_IAM Parameters are defined in separate Makefiles configured for each vendor separately. Vendor key is passed as parameter to command.
  • 43. Serverless web application with API Gateway Amazon S3 API Gateway AWS Lambda Amazon CloudFront Amazon S3 stores all the static content API Gateway handles all the application routing Lambda runs all the back-end logic CloudFront acts as CDN and is typically used to front this
  • 44. Serverless web application with API Gateway AWS Data Pipeline AWS Lambda Amazon S3 acts as a storage for new coming data AWS Data Pipeline ingests new data by scheduled interval Lambda performs final processing on the data Third-party data providers Third-party data providers push data to the respective bucket Amazon S3 CloudWatch events (time-based) Amazon Redshift Final data storage Grafana (visualization)
  • 48. Lambda cold start What is a cold start?  When running a serverless function, it will stay active (hot) as long as you're running it  After a period of inactivity, your cloud provider will drop the container, and your function will become inactive (cold)  A cold start happens when you execute an inactive function. The delay comes from your cloud provider provisioning your selected runtime container and then running your function  This process will considerably increase your execution time !!! Provisioning of the function's container can take > 5 seconds. That makes it impossible to guarantee < 1 second latency.
  • 49. Lambda warm-up How to keep Lambda warm?  Create scheduled event to invoke Lambda in configured time interval to keep the force the container to stay alive  In case of Serverless Framework there’s serverless-plugin-warmup which provides a possibility to keep Lambda warm !!! Containers are not reused after ~ 15 minutes of inactivity. Knowing the system features will help to answer the question whether the warmup is needed.
  • 50. Lambda pitfalls Lambda function not invoked by service: Lambda permissions must be configured to allow invocations by certain service Function fails by timeout or memory lack: Timeout and MemorySize settings should be explicitly stated. In most cases it’s better to increase Memory Size Exception occurs during the call inside the function: In case Lambda performs access to a service, there should be related permissions configured in Lambda role Logs don’t appear in CloudWatch: Function needs permissions to call CloudWatch Logs. Execution role has to be updated to grant the latter
  • 51. Summary  Serverless approach allows to pay for usage and save the money  Fits to suitable business cases where no dedicated servers are required  Serverless is suitable in case service can be encapsulated in single function  No provisioning and maintenance from your side  Easy local development and testing  Wide range of AWS tools to build Serverless applications