a quick introduction to aws lambda
TRANSCRIPT
@ogeisser #Devoxx #AWS-Lambda
AWS Compute Options
EC2
Virtual Machine Execution
ECS
Docker Container Execution
Function Execution
Lambda
@ogeisser #Devoxx #AWS-Lambda
Overview
Upload Code
Configure Trigger (Event Source)
Lambda invokes your code
Pay per invocation
@ogeisser #Devoxx #AWS-Lambda
Your Code Language Runtimes• Node.js (0.10.36)
• Java 8
• Python 2.7
Execution Environment• Amazon Linux AMI
• Your code has complete control
• Threads, Sockets, Filesystem, etc.
• Requirement: your code should be stateless
@ogeisser #Devoxx #AWS-Lambda
Programing Model Concepts with language specific implementations• Stateless function handler
• Event data as parameter
• Context support
• Logging support
Deployment• Package (ZIP file) your code & libs
• Upload directly to Lambda or to S3
@ogeisser #Devoxx #AWS-Lambda
Invocation Types Event• Asynchronous invocation
• One-Way – no response
Request/Response• Your code provides the response
• Synchronous invocation
@ogeisser #Devoxx #AWS-Lambda
Integration Model: Push vs. Pull Pull• Lambda polls the Event Source in a loop
Push• Event Source invokes Lambda
@ogeisser #Devoxx #AWS-Lambda
Pull Example: Kinesis Pull• Lambda polls���
Kinesis in a loop
• Invokes function for���new data
@ogeisser #Devoxx #AWS-Lambda
Push Example: S3
Push• S3 invokes Lambda���
with event invocation
• Triggered by any S3 action
@ogeisser #Devoxx #AWS-Lambda
AWS Services triggering Lambda AWS Service Push vs. Pull Event vs. Req/Resp
S3 Push Event
Dynamo DB Pull Event
Kinesis Pull Event
SNS Push Event
SES Push Event
Cognito Push Req/Resp
Cloud Watch Push Event
Cloud Formation Push Req/Resp
Alexa Push Req/Resp
@ogeisser #Devoxx #AWS-Lambda
On-Demand Invocation Lambda API• Directly call the Lambda function via the API
AWS API Gateway• Maps API Gateway calls to Lambda function invocations
Scheduled• Fixed rate and CRON expression support
@ogeisser #Devoxx #AWS-Lambda
Monitoring Metrics• Automatic metrics���
through Cloud Watch
Logs• All requests
• Logs generated by your���code
@ogeisser #Devoxx #AWS-Lambda
Miscellaneous Remarks Container Model is not documented• There is a „container model“ behind the scenes
• It‘s not documented
• But „Freezing“ and „Thawing“ of containers is noticeable
„Cold“ Start Up Time• There are language dependent different „cold“ startup times
• Java is much slower than Node.js
• This has a cost impact