SlideShare a Scribd company logo
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
Serverless frameworks on AWS
Julien Simon, Principal Technical Evangelist, AWS
julsimon@amazon.fr 
@julsimon
AWS Lambda

•  Announced at re:Invent 2014
•  Deploy functions in Java, Python, Node.js and C#
•  Just code, without the infrastructure drama
•  Built-in scalability and high availability
•  Well integrated with other AWS services
•  Pay as you go
•  Combination of execution time (100ms slots) & memory used
•  Free tier available
AWS re:Invent 2014 | (MBL202) NEW LAUNCH: Getting Started with AWS Lambda https://www.youtube.com/watch?v=UFj27laTWQA
What can you do with AWS Lambda?
•  Grow ‘connective tissue’ in your AWS infrastructure
–  Example: http://www.slideshare.net/JulienSIMON5/building-a-serverless-pipeline 

•  Build event-driven applications
•  Build APIs together with Amazon API Gateway
•  RESTful APIs
•  Resources, methods
•  Stages
http://aws.amazon.com/lambda 
http://aws.amazon.com/apigateway
AWS Lambda "
+ "
Managed services"
= "
Serverless architecture"


Reference architectures: http://www.allthingsdistributed.com/2016/06/aws-lambda-serverless-reference-architectures.html
Werner Vogels, CTO, Amazon.com
AWS re:Invent 2015
https://read.acloud.guru/serverless-the-future-of-software-architecture-d4473ffed864 
A Cloud Guru: 100% Serverless
Typical development workflow with AWS Lambda
1.  Write and deploy a Lambda function
2.  Create and deploy a REST API with API Gateway
3.  Connect the API to the Lambda function
4.  Invoke the API
5.  Test, debug and repeat ;)
A simple Lambda function in Python"

def lambda_handler(event,context):
   result = event['value1'] + event['value2']
   return result
aws lambda create-function --function-name add 
--handler myFunc.lambda_handler --runtime python2.7 
--zip-file fileb://myFunc.zip --memory-size 128 
--role arn:aws:iam::ACCOUNT_NUMBER:role/lambda_basic_execution
curl -H "Content-Type: application/json" 
-X POST -d "{"value1":5, "value2":7}" 
https://API_ENDPOINT
12
That’s great, but…
•  No one wants to code in the AWS console (right?)
•  Managing functions with the AWS CLI isn’t dev-friendly
•  Managing APIs with the AWS CLI quite complex (low-level calls)
•  CloudFormation doesn’t make it easy to deploy and manage
serverless applications (custom resources)

•  So what are the options?
Serverless tools
•  Development
–  Serverless Framework
–  Gordon
–  AWS Chalice
–  More frameworks: Kappa, Apex, Zappa, Docker-lambda
–  AWS Lambda plugin for Eclipse
•  Deployment
–  AWS Serverless Application Framework (SAM)
"
"
Development"Code samples available at https://github.com/juliensimon/aws/tree/master/lambda_frameworks "
"
The Serverless framework "
formerly known as JAWS: Just AWS Without Servers


•  Announced at re:Invent 2015 by Austen Collins and Ryan Pendergast
•  Supports Node.js, as well as Python and Java (with restrictions) 
•  Auto-deploys and runs Lambda functions, locally or remotely

•  Auto-deploys your Lambda event sources: API Gateway, S3, DynamoDB, etc.
•  Creates all required infrastructure with CloudFormation
•  Simple configuration in YML

http://github.com/serverless/serverless 
https://serverless.com 
AWS re:Invent 2015 | (DVO209) https://www.youtube.com/watch?v=D_U6luQ6I90 & https://vimeo.com/141132756
Serverless: standalone function
$ serverless create --template aws-python
Edit handler.py, serverless.yml and event.json
$ serverless deploy
$ serverless invoke 

[ local ] Only supported for Node.js :-/

--function function_name
[ --path event.json ]
$ serverless logs --function function_name
Serverless: API + function
Update serverless.yml, add JSON processing in handler.py
$ serverless deploy --stage stage_name
$ serverless info
$ curl -H "Content-Type: application/json" 
-X POST -d "{"value1":5, "value2":7}" 
https://API_ENDPOINT
Gordon
•  Released in Oct’15 by Jorge Batista
•  Supports Python, Javascript, Golang, Java, Scala, Kotlin (including in the same project)
•  Auto-deploys and runs Lambda functions, locally or remotely

•  Auto-deploys your Lambda event sources: API Gateway, CloudWatch Events, DynamoDB
Streams, Kinesis Streams, S3
•  Creates all required infrastructure with CloudFormation

•  Simple configuration in YML
https://github.com/jorgebastida/gordon 
https://news.ycombinator.com/item?id=11821295
Gordon: “Hello World” API
$ gordon startproject helloworld
$ gordon startapp helloapp
Write hellofunc() function
$ gordon build
$ echo '{"name":"Julien"}' | gordon run helloapp.hellofunc
$ gordon apply --stage stage_name
$ http post $API_ENDPOINT name=Julien
AWS Chalice "
Think of it as a serverless framework for Flask apps"

•  Released in Jul’16, still in beta
•  Just add your Python code
–  Deploy with a single call and zero config
–  The API is created automatically, the IAM policy is auto-generated
•  Run APIs locally on port 8000 (similar to Flask)
•  Fast & lightweight framework
–  100% boto3 calls (AWS SDK for Python) à fast
–  No integration with CloudFormation à no creation of event sources
https://github.com/awslabs/chalice 
https://aws.amazon.com/blogs/developer/preview-the-python-serverless-microframework-for-aws/
AWS Chalice: “Hello World” API
$ chalice new-project helloworld
Write your function in app.py
$ chalice local
$ chalice deploy
$ export API_ENDPOINT = `chalice url`
$ http $API_ENDPOINT
$ http put $API_ENDPOINT’hello/julien’
$ chalice logs [ --include-lambda-messages ]
AWS Chalice: PUT/GET in S3 bucket
$ chalice new-project s3test
Write your function in app.py
$ chalice local
$ http put http://localhost:8000/objects/doc.json value1=5 value2=8
$ http get http://localhost:8000/objects/doc.json
$ chalice deploy stage_name
$ export API_ENDPOINT=`chalice url`
$ http put $API_ENDPOINT/objects/doc.json value1=5 value2=8
$ http get $API_ENDPOINT/objects/doc.json
Summing things up
Serverless

The most popular
serverless framework

Built with and for Node.js.
Python and Java: YMMV

Rich features, many event
sources

Not a web framework
Gordon

Great challenger!

Node.js, Python, Java,
Scala, Golang

Comparable to Serverless
feature-wise

Not a web framework



Chalice

AWS project, in beta

Python only

Does only one thing, but
does it great

Dead simple, zero config

Flask web framework
More Lambda frameworks
•  Kappa https://github.com/garnaat/kappa 
–  Released Dec’14 by Mitch Garnaat, author of boto and the AWS CLI (still maintained?)
–  Python only, multiple event sources
•  Apex https://github.com/apex/apex 
–  Released in Dec’15 by TJ Holowaychuk
–  Python, Javascript, Java, Golang
–  Terraform integration to manage infrastructure for event sources
•  Zappa https://github.com/Miserlou/Zappa 
–  Released in Feb’16 by Rich Jones
–  Python web applications on AWS Lambda + API Gateway
•  Docker-lambda https://github.com/lambci/docker-lambda 
–  Released in May’16 by Michael Hart
–  Run functions in Docker images that “replicate” the live Lambda environment
AWS Lambda plug-in for Eclipse












https://java.awsblog.com/post/TxWZES6J1RSQ2Z/Testing-Lambda-functions-using-the-AWS-Toolkit-for-Eclipse 
https://aws.amazon.com/blogs/developer/aws-toolkit-for-eclipse-serverless-application 
Code, test and deploy Lambdas from Eclipse

Run your functions locally and remotely

Test with local events and Junit4 

Deploy standalone functions, or with the "
AWS Serverless Application Model (Dec’16)
"
"
Deployment"
AWS Serverless Application Model (SAM)"
formerly known as Project Flourish
•  CloudFormation extension released in Nov’16 to bundle
Lambda functions, APIs & events
•  3 new CloudFormation resource types
–  AWS::Serverless::Function
–  AWS::Serverless::Api
–  AWS::Serverless::SimpleTable
•  2 new CloudFormation commands
–  ‘aws cloudformation package’
–  ‘aws cloudformation deploy’
•  Integration with CodeBuild and CodePipeline for CI/CD
•  Expect SAM to be integrated in most / all frameworks
https://aws.amazon.com/fr/blogs/compute/introducing-simplified-serverless-application-deplyoment-and-management 
https://github.com/awslabs/serverless-application-model/
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Get items from a DynamoDB table.
Resources:
GetFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.get
Runtime: nodejs4.3
Policies: AmazonDynamoDBReadOnlyAccess
Environment:
Variables:
TABLE_NAME: !Ref Table
Events:
GetResource:
Type: Api
Properties:
Path: /resource/{resourceId}
Method: get
Table:
Type: AWS::Serverless::SimpleTable

Sample SAM template for:

•  Lambda function
•  HTTP GET API
•  DynamoDB table
"
"
Going further"
Latest Lambda features
•  18/11 Environment variables
•  01/12 New service: AWS Lambda@Edge
•  01/12 New service: AWS Step Functions 
•  01/12 New service: AWS Greengrass
•  01/12 Dead letter queues
•  01/12 C# support

https://aws.amazon.com/fr/blogs/compute/simplify-serverless-applications-with-environment-variables-in-aws-lambda/ 
https://aws.amazon.com/blogs/aws/coming-soon-lambda-at-the-edge/
https://aws.amazon.com/blogs/aws/new-aws-step-functions-build-distributed-applications-using-visual-workflows/
https://aws.amazon.com/blogs/aws/aws-greengrass-ubiquitous-real-world-computing/ 
https://aws.amazon.com/fr/blogs/compute/robust-serverless-application-design-with-aws-lambda-dlq/ 
https://aws.amazon.com/fr/blogs/compute/announcing-c-sharp-support-for-aws-lambda/
New Lambda videos from re:Invent 2016
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
https://www.youtube.com/watch?v=CwxWhyGteNc 

AWS re:Invent 2016: Serverless Apps with AWS Step Functions (SVR201)
https://www.youtube.com/watch?v=75MRve4nv8s 

AWS re:Invent 2016: Real-time Data Processing Using AWS Lambda (SVR301)
https://www.youtube.com/watch?v=VFLKOy4GKXQ 

AWS re:Invent 2016: Serverless Architectural Patterns and Best Practices (ARC402)
https://www.youtube.com/watch?v=b7UMoc1iUYw 

‪AWS re:Invent 2016: Bringing AWS Lambda to the Edge (CTD206)‬
https://www.youtube.com/watch?v=j26novaqF6M 

‪AWS re:Invent 2016: Ubiquitous Computing with Greengrass (IOT201)‬
https://www.youtube.com/watch?v=XQQjX8GTEko
The only Lambda book you need to read
Written by AWS Technical
Evangelist Danilo Poccia

Released in Nov’16

https://www.amazon.com/Aws-Lambda-Action-
Event-driven-Applications/dp/1617293717/
Thank you!"
	
Julien	Simon,	Principal	Technical	Evangelist,	AWS	
julsimon@amazon.fr	
@julsimon

More Related Content

PDF
Developing and deploying serverless applications (February 2017)
PDF
Building a Serverless Pipeline
PDF
Building serverless apps with Node.js
PDF
Building Serverless APIs on AWS
PDF
Building Serverless APIs (January 2017)
PDF
Write less (code) and build more with serverless
PDF
An introduction to serverless architectures (February 2017)
PDF
Continuous Deployment with Amazon Web Services
Developing and deploying serverless applications (February 2017)
Building a Serverless Pipeline
Building serverless apps with Node.js
Building Serverless APIs on AWS
Building Serverless APIs (January 2017)
Write less (code) and build more with serverless
An introduction to serverless architectures (February 2017)
Continuous Deployment with Amazon Web Services

What's hot (11)

PDF
DevOps with Amazon Web Services (November 2016)
PDF
Infrastructure as code with Amazon Web Services
PDF
A 60-minute tour of AWS Compute (November 2016)
PDF
AWS CloudFormation (February 2016)
PDF
Deep Dive: Amazon Relational Database Service (March 2017)
PPTX
Moving Viadeo to AWS (2015)
PDF
"How to optimize the architecture of your platform" by Julien Simon
PDF
Serverless architecture with AWS Lambda (June 2016)
PDF
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
PDF
A 60-mn tour of AWS compute (March 2016)
PDF
Workshop AWS IoT @ SIDO
DevOps with Amazon Web Services (November 2016)
Infrastructure as code with Amazon Web Services
A 60-minute tour of AWS Compute (November 2016)
AWS CloudFormation (February 2016)
Deep Dive: Amazon Relational Database Service (March 2017)
Moving Viadeo to AWS (2015)
"How to optimize the architecture of your platform" by Julien Simon
Serverless architecture with AWS Lambda (June 2016)
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
A 60-mn tour of AWS compute (March 2016)
Workshop AWS IoT @ SIDO
Ad

Viewers also liked (16)

PDF
An overview of Amazon Athena
PPT
Presentacion Computacion Social
PPTX
AWSPeru Meetup marzo - introduccion a elastic containers seervice
PDF
Yo tampoco quise estudiar telecomunicaciones en la UNE
PDF
Leveraging the Security of AWS's Own APIs for Your App - AWS Serverless Web Day
PDF
Securing Serverless Architectures - AWS Serverless Web Day
PDF
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
PDF
Security Boundaries and Functions of Services for Serverless Architectures on...
PPTX
從劍宗到氣宗 - 談AWS ECS與Serverless最佳實踐
PPTX
File Format Benchmark - Avro, JSON, ORC & Parquet
PDF
DevSecOps in Baby Steps
PDF
Build a Server-less Event-driven Backend with AWS Lambda and Amazon API Gateway
PDF
AWS Serverless Workshop
PDF
DevSecOps - The big picture
PDF
DevSecOps: Taking a DevOps Approach to Security
PPTX
DEVSECOPS: Coding DevSecOps journey
An overview of Amazon Athena
Presentacion Computacion Social
AWSPeru Meetup marzo - introduccion a elastic containers seervice
Yo tampoco quise estudiar telecomunicaciones en la UNE
Leveraging the Security of AWS's Own APIs for Your App - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web Day
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Security Boundaries and Functions of Services for Serverless Architectures on...
從劍宗到氣宗 - 談AWS ECS與Serverless最佳實踐
File Format Benchmark - Avro, JSON, ORC & Parquet
DevSecOps in Baby Steps
Build a Server-less Event-driven Backend with AWS Lambda and Amazon API Gateway
AWS Serverless Workshop
DevSecOps - The big picture
DevSecOps: Taking a DevOps Approach to Security
DEVSECOPS: Coding DevSecOps journey
Ad

Similar to Serverless Frameworks on AWS (11)

PDF
Building serverless applications (April 2018)
PDF
用Serverless技術快速開發line聊天機器人
PDF
PDF
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
PDF
Application Lifecycle Management on AWS
PDF
서버리스(Serverless) 프레임웍 비교 - ClaudiaJS와 Chalice를 중심으로 (윤석찬)
PDF
AWS re:Invent 2020 Serverless Recap
PPTX
muCon 2017 - 12 Factor Serverless Applications
PDF
IaC on AWS Cloud
PDF
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
PDF
Infrastructure as Code on AWS
Building serverless applications (April 2018)
用Serverless技術快速開發line聊天機器人
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Application Lifecycle Management on AWS
서버리스(Serverless) 프레임웍 비교 - ClaudiaJS와 Chalice를 중심으로 (윤석찬)
AWS re:Invent 2020 Serverless Recap
muCon 2017 - 12 Factor Serverless Applications
IaC on AWS Cloud
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Infrastructure as Code on AWS

More from Julien SIMON (20)

PDF
Implementing high-quality and cost-effiient AI applications with small langua...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
PDF
Arcee AI - building and working with small language models (06/25)
PDF
deep_dive_multihead_latent_attention.pdf
PDF
Deep Dive: Model Distillation with DistillKit
PDF
Deep Dive: Parameter-Efficient Model Adaptation with LoRA and Spectrum
PDF
Building High-Quality Domain-Specific Models with Mergekit
PDF
Tailoring Small Language Models for Enterprise Use Cases
PDF
Tailoring Small Language Models for Enterprise Use Cases
PDF
Julien Simon - Deep Dive: Compiling Deep Learning Models
PDF
Tailoring Small Language Models for Enterprise Use Cases
PDF
Julien Simon - Deep Dive - Optimizing LLM Inference
PDF
Julien Simon - Deep Dive - Accelerating Models with Better Attention Layers
PDF
Julien Simon - Deep Dive - Quantizing LLMs
PDF
Julien Simon - Deep Dive - Model Merging
PDF
An introduction to computer vision with Hugging Face
PDF
Reinventing Deep Learning
 with Hugging Face Transformers
PDF
Building NLP applications with Transformers
PPTX
Building Machine Learning Models Automatically (June 2020)
Implementing high-quality and cost-effiient AI applications with small langua...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Trying to figure out MCP by actually building an app from scratch with open s...
Arcee AI - building and working with small language models (06/25)
deep_dive_multihead_latent_attention.pdf
Deep Dive: Model Distillation with DistillKit
Deep Dive: Parameter-Efficient Model Adaptation with LoRA and Spectrum
Building High-Quality Domain-Specific Models with Mergekit
Tailoring Small Language Models for Enterprise Use Cases
Tailoring Small Language Models for Enterprise Use Cases
Julien Simon - Deep Dive: Compiling Deep Learning Models
Tailoring Small Language Models for Enterprise Use Cases
Julien Simon - Deep Dive - Optimizing LLM Inference
Julien Simon - Deep Dive - Accelerating Models with Better Attention Layers
Julien Simon - Deep Dive - Quantizing LLMs
Julien Simon - Deep Dive - Model Merging
An introduction to computer vision with Hugging Face
Reinventing Deep Learning
 with Hugging Face Transformers
Building NLP applications with Transformers
Building Machine Learning Models Automatically (June 2020)

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
Teaching material agriculture food technology
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
August Patch Tuesday
PDF
Getting Started with Data Integration: FME Form 101
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Spectroscopy.pptx food analysis technology
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Encapsulation theory and applications.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
OMC Textile Division Presentation 2021.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
SOPHOS-XG Firewall Administrator PPT.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
Univ-Connecticut-ChatGPT-Presentaion.pdf
cloud_computing_Infrastucture_as_cloud_p
Unlocking AI with Model Context Protocol (MCP)
August Patch Tuesday
Getting Started with Data Integration: FME Form 101
Assigned Numbers - 2025 - Bluetooth® Document
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectroscopy.pptx food analysis technology
A comparative study of natural language inference in Swahili using monolingua...
Encapsulation theory and applications.pdf
Heart disease approach using modified random forest and particle swarm optimi...
Empathic Computing: Creating Shared Understanding
OMC Textile Division Presentation 2021.pptx

Serverless Frameworks on AWS

  • 1. ©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved Serverless frameworks on AWS Julien Simon, Principal Technical Evangelist, AWS [email protected] @julsimon
  • 2. AWS Lambda •  Announced at re:Invent 2014 •  Deploy functions in Java, Python, Node.js and C# •  Just code, without the infrastructure drama •  Built-in scalability and high availability •  Well integrated with other AWS services •  Pay as you go •  Combination of execution time (100ms slots) & memory used •  Free tier available AWS re:Invent 2014 | (MBL202) NEW LAUNCH: Getting Started with AWS Lambda https://www.youtube.com/watch?v=UFj27laTWQA
  • 3. What can you do with AWS Lambda? •  Grow ‘connective tissue’ in your AWS infrastructure –  Example: http://www.slideshare.net/JulienSIMON5/building-a-serverless-pipeline •  Build event-driven applications •  Build APIs together with Amazon API Gateway •  RESTful APIs •  Resources, methods •  Stages http://aws.amazon.com/lambda http://aws.amazon.com/apigateway
  • 4. AWS Lambda " + " Managed services" = " Serverless architecture" Reference architectures: http://www.allthingsdistributed.com/2016/06/aws-lambda-serverless-reference-architectures.html
  • 5. Werner Vogels, CTO, Amazon.com AWS re:Invent 2015
  • 7. Typical development workflow with AWS Lambda 1.  Write and deploy a Lambda function 2.  Create and deploy a REST API with API Gateway 3.  Connect the API to the Lambda function 4.  Invoke the API 5.  Test, debug and repeat ;)
  • 8. A simple Lambda function in Python" def lambda_handler(event,context):    result = event['value1'] + event['value2']    return result aws lambda create-function --function-name add --handler myFunc.lambda_handler --runtime python2.7 --zip-file fileb://myFunc.zip --memory-size 128 --role arn:aws:iam::ACCOUNT_NUMBER:role/lambda_basic_execution curl -H "Content-Type: application/json" -X POST -d "{"value1":5, "value2":7}" https://API_ENDPOINT 12
  • 9. That’s great, but… •  No one wants to code in the AWS console (right?) •  Managing functions with the AWS CLI isn’t dev-friendly •  Managing APIs with the AWS CLI quite complex (low-level calls) •  CloudFormation doesn’t make it easy to deploy and manage serverless applications (custom resources) •  So what are the options?
  • 10. Serverless tools •  Development –  Serverless Framework –  Gordon –  AWS Chalice –  More frameworks: Kappa, Apex, Zappa, Docker-lambda –  AWS Lambda plugin for Eclipse •  Deployment –  AWS Serverless Application Framework (SAM)
  • 11. " " Development"Code samples available at https://github.com/juliensimon/aws/tree/master/lambda_frameworks " "
  • 12. The Serverless framework " formerly known as JAWS: Just AWS Without Servers •  Announced at re:Invent 2015 by Austen Collins and Ryan Pendergast •  Supports Node.js, as well as Python and Java (with restrictions) •  Auto-deploys and runs Lambda functions, locally or remotely •  Auto-deploys your Lambda event sources: API Gateway, S3, DynamoDB, etc. •  Creates all required infrastructure with CloudFormation •  Simple configuration in YML http://github.com/serverless/serverless https://serverless.com AWS re:Invent 2015 | (DVO209) https://www.youtube.com/watch?v=D_U6luQ6I90 & https://vimeo.com/141132756
  • 13. Serverless: standalone function $ serverless create --template aws-python Edit handler.py, serverless.yml and event.json $ serverless deploy $ serverless invoke 
 [ local ] Only supported for Node.js :-/
 --function function_name [ --path event.json ] $ serverless logs --function function_name
  • 14. Serverless: API + function Update serverless.yml, add JSON processing in handler.py $ serverless deploy --stage stage_name $ serverless info $ curl -H "Content-Type: application/json" -X POST -d "{"value1":5, "value2":7}" https://API_ENDPOINT
  • 15. Gordon •  Released in Oct’15 by Jorge Batista •  Supports Python, Javascript, Golang, Java, Scala, Kotlin (including in the same project) •  Auto-deploys and runs Lambda functions, locally or remotely •  Auto-deploys your Lambda event sources: API Gateway, CloudWatch Events, DynamoDB Streams, Kinesis Streams, S3 •  Creates all required infrastructure with CloudFormation •  Simple configuration in YML https://github.com/jorgebastida/gordon https://news.ycombinator.com/item?id=11821295
  • 16. Gordon: “Hello World” API $ gordon startproject helloworld $ gordon startapp helloapp Write hellofunc() function $ gordon build $ echo '{"name":"Julien"}' | gordon run helloapp.hellofunc $ gordon apply --stage stage_name $ http post $API_ENDPOINT name=Julien
  • 17. AWS Chalice " Think of it as a serverless framework for Flask apps" •  Released in Jul’16, still in beta •  Just add your Python code –  Deploy with a single call and zero config –  The API is created automatically, the IAM policy is auto-generated •  Run APIs locally on port 8000 (similar to Flask) •  Fast & lightweight framework –  100% boto3 calls (AWS SDK for Python) à fast –  No integration with CloudFormation à no creation of event sources https://github.com/awslabs/chalice https://aws.amazon.com/blogs/developer/preview-the-python-serverless-microframework-for-aws/
  • 18. AWS Chalice: “Hello World” API $ chalice new-project helloworld Write your function in app.py $ chalice local $ chalice deploy $ export API_ENDPOINT = `chalice url` $ http $API_ENDPOINT $ http put $API_ENDPOINT’hello/julien’ $ chalice logs [ --include-lambda-messages ]
  • 19. AWS Chalice: PUT/GET in S3 bucket $ chalice new-project s3test Write your function in app.py $ chalice local $ http put http://localhost:8000/objects/doc.json value1=5 value2=8 $ http get http://localhost:8000/objects/doc.json $ chalice deploy stage_name $ export API_ENDPOINT=`chalice url` $ http put $API_ENDPOINT/objects/doc.json value1=5 value2=8 $ http get $API_ENDPOINT/objects/doc.json
  • 20. Summing things up Serverless The most popular serverless framework Built with and for Node.js. Python and Java: YMMV Rich features, many event sources Not a web framework Gordon Great challenger! Node.js, Python, Java, Scala, Golang Comparable to Serverless feature-wise Not a web framework Chalice AWS project, in beta Python only Does only one thing, but does it great Dead simple, zero config Flask web framework
  • 21. More Lambda frameworks •  Kappa https://github.com/garnaat/kappa –  Released Dec’14 by Mitch Garnaat, author of boto and the AWS CLI (still maintained?) –  Python only, multiple event sources •  Apex https://github.com/apex/apex –  Released in Dec’15 by TJ Holowaychuk –  Python, Javascript, Java, Golang –  Terraform integration to manage infrastructure for event sources •  Zappa https://github.com/Miserlou/Zappa –  Released in Feb’16 by Rich Jones –  Python web applications on AWS Lambda + API Gateway •  Docker-lambda https://github.com/lambci/docker-lambda –  Released in May’16 by Michael Hart –  Run functions in Docker images that “replicate” the live Lambda environment
  • 22. AWS Lambda plug-in for Eclipse https://java.awsblog.com/post/TxWZES6J1RSQ2Z/Testing-Lambda-functions-using-the-AWS-Toolkit-for-Eclipse https://aws.amazon.com/blogs/developer/aws-toolkit-for-eclipse-serverless-application Code, test and deploy Lambdas from Eclipse Run your functions locally and remotely Test with local events and Junit4 Deploy standalone functions, or with the " AWS Serverless Application Model (Dec’16)
  • 24. AWS Serverless Application Model (SAM)" formerly known as Project Flourish •  CloudFormation extension released in Nov’16 to bundle Lambda functions, APIs & events •  3 new CloudFormation resource types –  AWS::Serverless::Function –  AWS::Serverless::Api –  AWS::Serverless::SimpleTable •  2 new CloudFormation commands –  ‘aws cloudformation package’ –  ‘aws cloudformation deploy’ •  Integration with CodeBuild and CodePipeline for CI/CD •  Expect SAM to be integrated in most / all frameworks https://aws.amazon.com/fr/blogs/compute/introducing-simplified-serverless-application-deplyoment-and-management https://github.com/awslabs/serverless-application-model/
  • 25. AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Get items from a DynamoDB table. Resources: GetFunction: Type: AWS::Serverless::Function Properties: Handler: index.get Runtime: nodejs4.3 Policies: AmazonDynamoDBReadOnlyAccess Environment: Variables: TABLE_NAME: !Ref Table Events: GetResource: Type: Api Properties: Path: /resource/{resourceId} Method: get Table: Type: AWS::Serverless::SimpleTable Sample SAM template for: •  Lambda function •  HTTP GET API •  DynamoDB table
  • 27. Latest Lambda features •  18/11 Environment variables •  01/12 New service: AWS Lambda@Edge •  01/12 New service: AWS Step Functions •  01/12 New service: AWS Greengrass •  01/12 Dead letter queues •  01/12 C# support https://aws.amazon.com/fr/blogs/compute/simplify-serverless-applications-with-environment-variables-in-aws-lambda/ https://aws.amazon.com/blogs/aws/coming-soon-lambda-at-the-edge/ https://aws.amazon.com/blogs/aws/new-aws-step-functions-build-distributed-applications-using-visual-workflows/ https://aws.amazon.com/blogs/aws/aws-greengrass-ubiquitous-real-world-computing/ https://aws.amazon.com/fr/blogs/compute/robust-serverless-application-design-with-aws-lambda-dlq/ https://aws.amazon.com/fr/blogs/compute/announcing-c-sharp-support-for-aws-lambda/
  • 28. New Lambda videos from re:Invent 2016 AWS re:Invent 2016: What’s New with AWS Lambda (SVR202) https://www.youtube.com/watch?v=CwxWhyGteNc AWS re:Invent 2016: Serverless Apps with AWS Step Functions (SVR201) https://www.youtube.com/watch?v=75MRve4nv8s AWS re:Invent 2016: Real-time Data Processing Using AWS Lambda (SVR301) https://www.youtube.com/watch?v=VFLKOy4GKXQ AWS re:Invent 2016: Serverless Architectural Patterns and Best Practices (ARC402) https://www.youtube.com/watch?v=b7UMoc1iUYw ‪AWS re:Invent 2016: Bringing AWS Lambda to the Edge (CTD206)‬ https://www.youtube.com/watch?v=j26novaqF6M ‪AWS re:Invent 2016: Ubiquitous Computing with Greengrass (IOT201)‬ https://www.youtube.com/watch?v=XQQjX8GTEko
  • 29. The only Lambda book you need to read Written by AWS Technical Evangelist Danilo Poccia Released in Nov’16 https://www.amazon.com/Aws-Lambda-Action- Event-driven-Applications/dp/1617293717/