SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Zürich, AWSomeDay
12. September 2018
How to go serverless with AWS Lambda
Roman Plessl, nine (AWS Partner)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
About myself and nine
Roman Plessl Working for nine as a Solution
Architect, Consultant and Leader.
As a Cloud Navigator we offer you
AWS Consulting, Migrations and
also Operations.
Besides nine I work as Consultant
and Teacher (ETH, Foundation's)
2
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Motivation for AWS Lambda
With AWS Lambda you don’t need to worry about
provisioning servers or scaling them.
Learn which workloads work best and how to go
serverless in this hands-on session.
3
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Motivation for AWS Lambda
What is Serverless Computing?
What is AWS Lambda?
Hands-on with Examples
4
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is Serverless Computing?
Architecture Paradigms
EC2 running behind
Load-Balancer
Container (ECS, EKS)
running behind Load-
Balancer
AWS Lambda running
behind API Gateway
5
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is Serverless Computing?
Architecture Paradigms
EC2
• Machine as the unit of
scale
• Virtual servers in the cloud
• I configure machines,
storage, networking and
OS
ECS / EKS
• Application as the unit of
scale
• Container Management
Service for running Docker
containers
• Fargate (PaaS)
• I run container
management servers,
configure apps, control
scaling
Lambda
• Function as the unit of
scale
• Abstracts the language
runtime
• I run my code when it’s
needed
6
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• It’s hip, next to containerizing
apps:
(and good for staffing developers)
• Server Management:
• No servers to manage
• Continuous scaling
• No idle / cold servers
What is Serverless Computing?
Benefit of Serverless Applications
• Cost sensitive:
• Pay per request, low charge
• Buy compute time in mini
increments
• No hourly, daily or monthly
minimums
• No per-device fees
• Never pay for idle
7
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
The serverless compute manifesto
https://blog.rowanudell.com/the-serverless-compute-manifesto
! Functions are the unit of deployment and scaling.
! No machines, VMs, or containers visible in the programming model.
! Permanent storage lives elsewhere.
! Scales per request; Users cannot over- or under-provision capacity.
! Never pay for idle (no cold servers/containers or their costs).
! Implicitly fault-tolerant because functions can run anywhere.
! BYOC - Bring Your Own Code.
! Metrics and logging are a universal right.
8
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda API (Sources, Functions, Services)
Requests to endpoints
Changes in data state
Changes in resource state
• Go
• Python
• node.js
• Java
• Powershell Core
• C#
FUNCTION SERVICES (anything)EVENT SOURCE
TRIGGERS USES
List event sources / triggers: https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html
Importance of IAM policies (attached to lambdas)
9
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Typical AWS Lambda Architecture
Amazon API
Gateway
Amazon
Cognito
IAM
Auth
Applications
Amazon
S3
Amazon
DynamoDB
Amazon
RDS
Amazon
ElastiCache
Data
Amazon
CloudWatch
Monitoring / Logging
AWS
Lambda
AWS Elastic
Beanstalk
AWS
CloudTrail
Amazon
SNS
10
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using AWS Lambda
Bring your own code
• Multiple languages (Go, Python, Node.js, Java, Powershell Core, C#)
• Bring your own libraries
Simple resource model
• Select power rating based on memory size from 128 MB to 3000 MB
• CPU and network are allocated proportionally
• Reports / metrics actual usage
11
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using AWS Lambda
Flexible use
• Call or send events
• Integrated with other AWS services
• Build server less ecosystems
Flexible authorization
• Securely grant access to resources, incl. VPCs
• Fine-grained control over who can call your function (Namespaces)
12
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using AWS Lambda
Programming Model
• Built-in AWS SDK
• Front end is Lambda
Authoring functions
• Author directly using the Cloud9 editor (some kind with version control)
• Package code as a ZIP and upload to S3 / Lambda console
13
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using AWS Lambda
Stateless
• Persist Data using DynamoDB, AWS Aurora Serverless, S3 or ElastiCache (states)
• No affinity to infrastructure (can’t login to host)
Monitoring and Logging
• Built in metrics for requests, latency, errors and throttles
• Built in logging with CloudWatch
14
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Lambda Pricing
• https://aws.amazon.com/lambda/pricing/
• Free tier: 1 million request, and 400’000 GB/s of compute
every month, for every customer
• AWS Lambda is cost effective when compared to EC2
• Keep in mind with AWS Lambda there is no infrastructure to
maintain
15
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DEMO AND HANDS-ON TIME
16
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 1 – TicTacToe
didactic approach - always start with something amusing
• AWS Lambda: Using in the GUI the
Serverless Application Repository
• Select: tic-tac-toe
• Learning how stuff works concretely from
examples
• Uses “poor-man-database” in filesystem
• Timeout is 180 seconds
AWS
Lambda
AWS cloud
Amazon API
Gateway
Browser 1
Browser 2
Amazon
CloudWatch
17
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 1 – TicTacToe
didactic approach - always start with something amusing
18
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 2 – Hello World with Versions and Aliases
implement best practices with an easy example
• AWS Lambda: Using in the GUI the
Serverless Application Repository
• Select: hello-world-python3
• Learning how to use versions and aliases
• Run 2 adapted versions of the same function
• … and split traffic to one of those two
instances
AWS
Lambda
AWS cloud
Amazon API
Gateway
AWS
Console
Amazon
CloudWatch
19
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 3 – S3 as an Input Source
Dynamic Data Ingestion with Lambda + S3
Amazon
S3
AWS
Lambda
Amazon
DynamoDB
Amazon
S3
AWS cloud
OBJEC
T
Stores processed object to S3
Updates file metadata to DynamoDB
20
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 3 – S3 as an Input Source
Dynamic Data Ingestion with Lambda + S3
1. Create S3 Bucket (e.g. YOURNAME-lambda-s3-upload)
2. Use s3-get-object-python3 blueprint with your bucket name
3. Upload a File with S3 Console
4. Have a look to the CloudWatch Logs
21
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
made of Lambda and EC2 instances
virtual private cloud PROD
AWS cloud Cust A
Service Host
(sh.vpc.example.com)
virtual private cloud STAGING
Service Host
(sh.vpc.example.com)
Amazon
Route 53
DDNS
Lambda
function
hosted zone
(vpc.example.com)
hosted zone
(vpc.example.com)
app
instances
app
instances
virtual private cloud PROD
AWS cloud Cust B
Service Host
(sh.vpc.example.com)
virtual private cloud STAGING
Service Host
(sh.vpc.example.com)
Amazon
Route 53
DDNS
Lambda
function
hosted zone
(vpc.example.com)
hosted zone
(vpc.example.com)
app
instances
app
instances
Solving a real life “problem”,
where the app servers
need a special common
but different gateway,
for each AWS account
and each AWS VPC context
22
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 4 – Service Host local DNS resolution using DDNS
made of Lambda and EC2 instances
https://github.com/rplessl/aws-lambda-ddns
class ServiceHostLambdaDDns:
ZoneName = 'vpc.example.com.'
def __init__(self, event, context):
…
self.r53 = ServiceHostLambdaDDnsRoute53(ServiceHostLambdaDDns.ZoneName)
…
if self._state() == 'running':
ec2 = boto3.resource('ec2')
instance = ec2.Instance(self.instance_id())
target = instance.private_dns_name
self.r53.add_cname('sh', target)
self.r53.add_cname('*.sh', target)
23
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example 5 – Using serverless framework (not SAM)
# see also serverless.com for documentation
# install node.js
brew install node.js
# install serverless framework
npm install -g serverless
# create node.js example and
serverless create --template aws-nodejs --path example1
cd example1
serverless deploy –v
serverless deploy function -f hello
serverless invoke -f hello –l
serverless logs -f hello –t
serverless remove
# improve example, see https://github.com/rplessl/aws-serverless-examples
# with https://docs.serverless.com and https://serverless-stack.com
24
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Lambda Best Practices (in general)
• Use Versions and Aliases in AWS Lambda Deployments
• AWS Lambda functions should be stateless
(focus: there will be used another sandbox)
• Using larger memory sizes will automatically provide more CPU
power
• Use CloudWatch to monitor AWS Lambda request latency
• Keep startup code to a minimum
• New instances can be started any time
25
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Lambda Best Practices (Testing)
• Use pipelines for coding with automated Tests
• Use mock’s for testing
• E.g. https://www.npmjs.com/package/aws-sdk-mock or https://github.com/spulec/moto
• Debug locally using
• AWS SAM Local
• Use small function parts
• Small functions with tests
• Extract functions to libraries
• Use Sample Event Data
• Prepare sample test events and document them
26
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Good Resources to Learn and Practice more with AWS
Lambda and Serverless
• Wild Rydes Serverless Workshops
Good full blown self-teaching workshops for
creating 5 different serverless use cases
https://github.com/aws-samples/aws-serverless-workshops
• Examples from the serverless toolkit
https://github.com/serverless/examples
27
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
And keep in mind!
“No server is easier to manage than no server”
@Werner, Re:Invent 2016
28
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Further Tools and Hints
29
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless Application Model
30
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is the Serverless Application Model
• Typical applications consist of AWS services in addition to AWS
Lambda functions
implementation by hand can / will be error prone
• SAM
• uses CloudFormation to define all components of a serverless application
and architecture
• supports a simplified syntax for serverless resources (Lambda, API
Gateway, DynamoDB)
• supports the resources CloudFormation supports.
• blueprints in the AWS lambda console
31
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Step functions
When running complex functions the following must-be or questions arises:
• I will have sequential flow(s) of my functions
• I want to run functions in parallel
• I will use a third party app on a EC2 or a container
• I have code that runs for hours
AWS Step functions makes it easy to coordinate components of distributed
applications using a visual workflow.
Step function task can be on AWS Lambda, ECS or EC2.
32
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Further Tools and Integrations
• lambCI
Serverless continuous integration (like Travis or CircleCI)
https://github.com/lambci/lambci
including a CloudFormation Launch Stack
• lambda-packages
“How to integrate libraries with C bindings like python?...”
Various Python libraries precompiled and selected for using with AWS Lambda
https://github.com/Miserlou/lambda-packages
33
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!
Roman Plessl
github.com/rplessl
Reach us
nine, AWS Partner
www.nine.ch/en/aws
34

Más contenido relacionado

La actualidad más candente

Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...Amazon Web Services
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless BackendsAmazon Web Services
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWSAmazon Web Services
 
AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos Amazon Web Services
 
SMC302 Building Serverless Web Applications
SMC302 Building Serverless Web ApplicationsSMC302 Building Serverless Web Applications
SMC302 Building Serverless Web ApplicationsAmazon Web Services
 
AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...
AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...
AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...Amazon Web Services
 
Wild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the RescueWild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the RescueAmazon Web Services
 
Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017
Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017
Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017Amazon Web Services
 
Jump Start your First Hour with AWS
Jump Start your First Hour with AWSJump Start your First Hour with AWS
Jump Start your First Hour with AWSAmazon Web Services
 
Content Management and Running your Website on AWS
Content Management and Running your Website on AWSContent Management and Running your Website on AWS
Content Management and Running your Website on AWSAmazon Web Services
 
AWS Batch: Simplifying batch computing in the cloud
AWS Batch: Simplifying batch computing in the cloudAWS Batch: Simplifying batch computing in the cloud
AWS Batch: Simplifying batch computing in the cloudAdrian Hornsby
 
Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)Adrian Hornsby
 
AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...
AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...
AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...Swapnil Pawar
 
Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017Amazon Web Services
 
AWS APAC Webinar Week - Launching Your First Big Data Project on AWS
AWS APAC Webinar Week - Launching Your First Big Data Project on AWSAWS APAC Webinar Week - Launching Your First Big Data Project on AWS
AWS APAC Webinar Week - Launching Your First Big Data Project on AWSAmazon Web Services
 

La actualidad más candente (19)

Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless Backends
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWS
 
AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos AWS Lambda@Edge Lightning Demos
AWS Lambda@Edge Lightning Demos
 
SMC302 Building Serverless Web Applications
SMC302 Building Serverless Web ApplicationsSMC302 Building Serverless Web Applications
SMC302 Building Serverless Web Applications
 
AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...
AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...
AWS re:Invent 2016: Workshop: AWS Professional Services Effective Architectin...
 
Wild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the RescueWild Rydes - Serverless DevOps to the Rescue
Wild Rydes - Serverless DevOps to the Rescue
 
Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017
Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017
Build a Serverless Web Application in One Day Workshop - DevDay Los Angeles 2017
 
Introduction to AWS Batch
Introduction to AWS BatchIntroduction to AWS Batch
Introduction to AWS Batch
 
AWS Black Belt Tips
AWS Black Belt TipsAWS Black Belt Tips
AWS Black Belt Tips
 
Jump Start your First Hour with AWS
Jump Start your First Hour with AWSJump Start your First Hour with AWS
Jump Start your First Hour with AWS
 
Content Management and Running your Website on AWS
Content Management and Running your Website on AWSContent Management and Running your Website on AWS
Content Management and Running your Website on AWS
 
AWS Batch: Simplifying batch computing in the cloud
AWS Batch: Simplifying batch computing in the cloudAWS Batch: Simplifying batch computing in the cloud
AWS Batch: Simplifying batch computing in the cloud
 
Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)
 
AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...
AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...
AWS Lambda Supports Parallelization Factor for Kinesis and DynamoDB Event Sou...
 
An Introduction to AWS
An Introduction to AWSAn Introduction to AWS
An Introduction to AWS
 
Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017
 
AWS APAC Webinar Week - Launching Your First Big Data Project on AWS
AWS APAC Webinar Week - Launching Your First Big Data Project on AWSAWS APAC Webinar Week - Launching Your First Big Data Project on AWS
AWS APAC Webinar Week - Launching Your First Big Data Project on AWS
 
Introduction to AWS Batch
Introduction to AWS BatchIntroduction to AWS Batch
Introduction to AWS Batch
 

Similar a AWSomeDay Zurich 2018 - How to go serverless

Serverless use cases with AWS Lambda
Serverless use cases with AWS Lambda Serverless use cases with AWS Lambda
Serverless use cases with AWS Lambda Boaz Ziniman
 
Getting started with Serverless on AWS
Getting started with Serverless on AWSGetting started with Serverless on AWS
Getting started with Serverless on AWSAdrian Hornsby
 
Serverless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversServerless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversAmazon Web Services
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSCodeOps Technologies LLP
 
Serverless Computing
Serverless Computing Serverless Computing
Serverless Computing Rushi Namani
 
Serverless Architecture and Best Practices
Serverless Architecture and Best PracticesServerless Architecture and Best Practices
Serverless Architecture and Best PracticesAmazon Web Services
 
Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM Amazon Web Services
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural PatternsAmazon Web Services
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural PatternsAdrian Hornsby
 
Serverless architecture-patterns-and-best-practices
Serverless architecture-patterns-and-best-practicesServerless architecture-patterns-and-best-practices
Serverless architecture-patterns-and-best-practicessaifam
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Chris Munns
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Amazon Web Services
 
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupIntroduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupBoaz Ziniman
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep DiveAmazon Web Services
 
Genomics on aws-webinar-april2018
Genomics on aws-webinar-april2018Genomics on aws-webinar-april2018
Genomics on aws-webinar-april2018Brendan Bouffler
 
Securing serverless and container services - SDD306 - AWS re:Inforce 2019
Securing serverless and container services - SDD306 - AWS re:Inforce 2019 Securing serverless and container services - SDD306 - AWS re:Inforce 2019
Securing serverless and container services - SDD306 - AWS re:Inforce 2019 Amazon Web Services
 
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Amazon Web Services
 
Building Serverless Microservices with AWS
Building Serverless Microservices with AWSBuilding Serverless Microservices with AWS
Building Serverless Microservices with AWSDonnie Prakoso
 

Similar a AWSomeDay Zurich 2018 - How to go serverless (20)

Serverless use cases with AWS Lambda
Serverless use cases with AWS Lambda Serverless use cases with AWS Lambda
Serverless use cases with AWS Lambda
 
Getting started with Serverless on AWS
Getting started with Serverless on AWSGetting started with Serverless on AWS
Getting started with Serverless on AWS
 
Serverless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about serversServerless computing - Build and run applications without thinking about servers
Serverless computing - Build and run applications without thinking about servers
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Serverless Computing
Serverless Computing Serverless Computing
Serverless Computing
 
Serverless Architecture and Best Practices
Serverless Architecture and Best PracticesServerless Architecture and Best Practices
Serverless Architecture and Best Practices
 
Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM Build and Deploy Serverless Applications with AWS SAM
Build and Deploy Serverless Applications with AWS SAM
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Serverless architecture-patterns-and-best-practices
Serverless architecture-patterns-and-best-practicesServerless architecture-patterns-and-best-practices
Serverless architecture-patterns-and-best-practices
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupIntroduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Genomics on aws-webinar-april2018
Genomics on aws-webinar-april2018Genomics on aws-webinar-april2018
Genomics on aws-webinar-april2018
 
AWS Serverless Development
AWS Serverless DevelopmentAWS Serverless Development
AWS Serverless Development
 
Securing serverless and container services - SDD306 - AWS re:Inforce 2019
Securing serverless and container services - SDD306 - AWS re:Inforce 2019 Securing serverless and container services - SDD306 - AWS re:Inforce 2019
Securing serverless and container services - SDD306 - AWS re:Inforce 2019
 
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
 
Building Serverless Microservices with AWS
Building Serverless Microservices with AWSBuilding Serverless Microservices with AWS
Building Serverless Microservices with AWS
 

Último

Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 

Último (20)

Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 

AWSomeDay Zurich 2018 - How to go serverless

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Zürich, AWSomeDay 12. September 2018 How to go serverless with AWS Lambda Roman Plessl, nine (AWS Partner)
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. About myself and nine Roman Plessl Working for nine as a Solution Architect, Consultant and Leader. As a Cloud Navigator we offer you AWS Consulting, Migrations and also Operations. Besides nine I work as Consultant and Teacher (ETH, Foundation's) 2
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Motivation for AWS Lambda With AWS Lambda you don’t need to worry about provisioning servers or scaling them. Learn which workloads work best and how to go serverless in this hands-on session. 3
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Motivation for AWS Lambda What is Serverless Computing? What is AWS Lambda? Hands-on with Examples 4
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is Serverless Computing? Architecture Paradigms EC2 running behind Load-Balancer Container (ECS, EKS) running behind Load- Balancer AWS Lambda running behind API Gateway 5
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is Serverless Computing? Architecture Paradigms EC2 • Machine as the unit of scale • Virtual servers in the cloud • I configure machines, storage, networking and OS ECS / EKS • Application as the unit of scale • Container Management Service for running Docker containers • Fargate (PaaS) • I run container management servers, configure apps, control scaling Lambda • Function as the unit of scale • Abstracts the language runtime • I run my code when it’s needed 6
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • It’s hip, next to containerizing apps: (and good for staffing developers) • Server Management: • No servers to manage • Continuous scaling • No idle / cold servers What is Serverless Computing? Benefit of Serverless Applications • Cost sensitive: • Pay per request, low charge • Buy compute time in mini increments • No hourly, daily or monthly minimums • No per-device fees • Never pay for idle 7
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The serverless compute manifesto https://blog.rowanudell.com/the-serverless-compute-manifesto ! Functions are the unit of deployment and scaling. ! No machines, VMs, or containers visible in the programming model. ! Permanent storage lives elsewhere. ! Scales per request; Users cannot over- or under-provision capacity. ! Never pay for idle (no cold servers/containers or their costs). ! Implicitly fault-tolerant because functions can run anywhere. ! BYOC - Bring Your Own Code. ! Metrics and logging are a universal right. 8
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda API (Sources, Functions, Services) Requests to endpoints Changes in data state Changes in resource state • Go • Python • node.js • Java • Powershell Core • C# FUNCTION SERVICES (anything)EVENT SOURCE TRIGGERS USES List event sources / triggers: https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html Importance of IAM policies (attached to lambdas) 9
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Typical AWS Lambda Architecture Amazon API Gateway Amazon Cognito IAM Auth Applications Amazon S3 Amazon DynamoDB Amazon RDS Amazon ElastiCache Data Amazon CloudWatch Monitoring / Logging AWS Lambda AWS Elastic Beanstalk AWS CloudTrail Amazon SNS 10
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using AWS Lambda Bring your own code • Multiple languages (Go, Python, Node.js, Java, Powershell Core, C#) • Bring your own libraries Simple resource model • Select power rating based on memory size from 128 MB to 3000 MB • CPU and network are allocated proportionally • Reports / metrics actual usage 11
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using AWS Lambda Flexible use • Call or send events • Integrated with other AWS services • Build server less ecosystems Flexible authorization • Securely grant access to resources, incl. VPCs • Fine-grained control over who can call your function (Namespaces) 12
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using AWS Lambda Programming Model • Built-in AWS SDK • Front end is Lambda Authoring functions • Author directly using the Cloud9 editor (some kind with version control) • Package code as a ZIP and upload to S3 / Lambda console 13
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using AWS Lambda Stateless • Persist Data using DynamoDB, AWS Aurora Serverless, S3 or ElastiCache (states) • No affinity to infrastructure (can’t login to host) Monitoring and Logging • Built in metrics for requests, latency, errors and throttles • Built in logging with CloudWatch 14
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda Pricing • https://aws.amazon.com/lambda/pricing/ • Free tier: 1 million request, and 400’000 GB/s of compute every month, for every customer • AWS Lambda is cost effective when compared to EC2 • Keep in mind with AWS Lambda there is no infrastructure to maintain 15
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DEMO AND HANDS-ON TIME 16
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 1 – TicTacToe didactic approach - always start with something amusing • AWS Lambda: Using in the GUI the Serverless Application Repository • Select: tic-tac-toe • Learning how stuff works concretely from examples • Uses “poor-man-database” in filesystem • Timeout is 180 seconds AWS Lambda AWS cloud Amazon API Gateway Browser 1 Browser 2 Amazon CloudWatch 17
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 1 – TicTacToe didactic approach - always start with something amusing 18
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 2 – Hello World with Versions and Aliases implement best practices with an easy example • AWS Lambda: Using in the GUI the Serverless Application Repository • Select: hello-world-python3 • Learning how to use versions and aliases • Run 2 adapted versions of the same function • … and split traffic to one of those two instances AWS Lambda AWS cloud Amazon API Gateway AWS Console Amazon CloudWatch 19
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 3 – S3 as an Input Source Dynamic Data Ingestion with Lambda + S3 Amazon S3 AWS Lambda Amazon DynamoDB Amazon S3 AWS cloud OBJEC T Stores processed object to S3 Updates file metadata to DynamoDB 20
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 3 – S3 as an Input Source Dynamic Data Ingestion with Lambda + S3 1. Create S3 Bucket (e.g. YOURNAME-lambda-s3-upload) 2. Use s3-get-object-python3 blueprint with your bucket name 3. Upload a File with S3 Console 4. Have a look to the CloudWatch Logs 21
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. made of Lambda and EC2 instances virtual private cloud PROD AWS cloud Cust A Service Host (sh.vpc.example.com) virtual private cloud STAGING Service Host (sh.vpc.example.com) Amazon Route 53 DDNS Lambda function hosted zone (vpc.example.com) hosted zone (vpc.example.com) app instances app instances virtual private cloud PROD AWS cloud Cust B Service Host (sh.vpc.example.com) virtual private cloud STAGING Service Host (sh.vpc.example.com) Amazon Route 53 DDNS Lambda function hosted zone (vpc.example.com) hosted zone (vpc.example.com) app instances app instances Solving a real life “problem”, where the app servers need a special common but different gateway, for each AWS account and each AWS VPC context 22
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 4 – Service Host local DNS resolution using DDNS made of Lambda and EC2 instances https://github.com/rplessl/aws-lambda-ddns class ServiceHostLambdaDDns: ZoneName = 'vpc.example.com.' def __init__(self, event, context): … self.r53 = ServiceHostLambdaDDnsRoute53(ServiceHostLambdaDDns.ZoneName) … if self._state() == 'running': ec2 = boto3.resource('ec2') instance = ec2.Instance(self.instance_id()) target = instance.private_dns_name self.r53.add_cname('sh', target) self.r53.add_cname('*.sh', target) 23
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example 5 – Using serverless framework (not SAM) # see also serverless.com for documentation # install node.js brew install node.js # install serverless framework npm install -g serverless # create node.js example and serverless create --template aws-nodejs --path example1 cd example1 serverless deploy –v serverless deploy function -f hello serverless invoke -f hello –l serverless logs -f hello –t serverless remove # improve example, see https://github.com/rplessl/aws-serverless-examples # with https://docs.serverless.com and https://serverless-stack.com 24
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda Best Practices (in general) • Use Versions and Aliases in AWS Lambda Deployments • AWS Lambda functions should be stateless (focus: there will be used another sandbox) • Using larger memory sizes will automatically provide more CPU power • Use CloudWatch to monitor AWS Lambda request latency • Keep startup code to a minimum • New instances can be started any time 25
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda Best Practices (Testing) • Use pipelines for coding with automated Tests • Use mock’s for testing • E.g. https://www.npmjs.com/package/aws-sdk-mock or https://github.com/spulec/moto • Debug locally using • AWS SAM Local • Use small function parts • Small functions with tests • Extract functions to libraries • Use Sample Event Data • Prepare sample test events and document them 26
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Good Resources to Learn and Practice more with AWS Lambda and Serverless • Wild Rydes Serverless Workshops Good full blown self-teaching workshops for creating 5 different serverless use cases https://github.com/aws-samples/aws-serverless-workshops • Examples from the serverless toolkit https://github.com/serverless/examples 27
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. And keep in mind! “No server is easier to manage than no server” @Werner, Re:Invent 2016 28
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Further Tools and Hints 29
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless Application Model 30
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is the Serverless Application Model • Typical applications consist of AWS services in addition to AWS Lambda functions implementation by hand can / will be error prone • SAM • uses CloudFormation to define all components of a serverless application and architecture • supports a simplified syntax for serverless resources (Lambda, API Gateway, DynamoDB) • supports the resources CloudFormation supports. • blueprints in the AWS lambda console 31
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step functions When running complex functions the following must-be or questions arises: • I will have sequential flow(s) of my functions • I want to run functions in parallel • I will use a third party app on a EC2 or a container • I have code that runs for hours AWS Step functions makes it easy to coordinate components of distributed applications using a visual workflow. Step function task can be on AWS Lambda, ECS or EC2. 32
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Further Tools and Integrations • lambCI Serverless continuous integration (like Travis or CircleCI) https://github.com/lambci/lambci including a CloudFormation Launch Stack • lambda-packages “How to integrate libraries with C bindings like python?...” Various Python libraries precompiled and selected for using with AWS Lambda https://github.com/Miserlou/lambda-packages 33
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you! Roman Plessl github.com/rplessl Reach us nine, AWS Partner www.nine.ch/en/aws 34