Getting Started with AWS Lambda
and the Serverless Cloud
Ian Massingham IanMmmm James Hall MrRio
Technical Evangelist, AWS Director, Parallax
AWS Community Hero
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS compute offerings
Amazon EC2 Amazon ECS AWS Lambda
Virtual servers Container management Serverless compute
in the Cloud service for running platform for stateless
Docker on a managed code execution in
cluster of EC2 response to events
Benefits of AWS Lambda
No servers to Continuous Never pay for idle
manage scaling – no cold servers
Pay-per request
• Buy compute time in
100 ms increments
• Low request charge
• No hourly, daily, or monthly
minimums
• No per-device fees
Free Tier
Never pay for idle! 1 million requests and 400,000 GBs of
compute every month, for every customer
Using AWS Lambda
Bring your own code Simple resource model
• Node.js, Java, Python, C# • Select power rating from 128
• Bring your own libraries MB to 1.5 GB
(even native ones) • CPU & network allocated
proportionately
• Metrics provide actual usage
Flexible use Flexible authorization
• Call or send events • Securely grant access to
• Integrated with other AWS resources, including VPCs
services • Fine-grained control over
• Build whole serverless who can call your functions
ecosystems
Using AWS Lambda
Programming model Stateless
• AWS SDK built in • Persist data using Amazon
• Lambda is the front end S3, ElastiCache, RDS or
non-relational databases
• Use processes, threads, /
tmp, sockets normally • No affinity to infrastructure
(can’t “log in to the box”)
Authoring functions Monitoring and logging
• Author directly using the • Built-in metrics for requests,
console WYSIWYG editor errors, latency & throttles
• Package code as a .zip & • Built-in logs in Amazon
upload to Lambda or S3 CloudWatch Logs
• Plugins for Eclipse & Visual
Studio
• Command line tools
Common usage scenarios
Data Triggers Control systems
Customise Customize responses and
behaviour on data response workflows to
updates in S3, SNS state changes within AWS
& more
Big data Serverless backends
Realtime Execute server side
processing of backend logic in a cross
streaming data platform fashion
updates using
Kinesis
Lambda + S3
Dynamic data ingestion using S3 + Lambda
ed
rocess
es p S3
Stor ject to
ob
Amazon S3
Updat
es
metad file
ata
Amazon S3 AWS Lambda Dynam to
oDB
processes
the object
Amazon
DynamoDB
New object
uploaded
AWS Step Functions
Customers using S3 + Lambda
Apply custom logic to process content
Processed files being uploaded into Amazon S3
• Watermarking / thumbnail creation
• Transcoding
• Indexing and de-duplication
Amazon S3 AWS Indexing • Aggregation and filtering
Bucket Lambda tables or • Pre processing
Events notifications
• Content validation
• WAF updates
Lambda + Kinesis
Dynamic data ingestion using S3 + Kinesis
&
s s data s
pre -Log
Com to CW
p
dum
Amazon
Filter
data a
CloudWatch Logs
alert S nd
NS on
Amazon AWS Lambda match
Kinesis processes
the stream
Amazon
SNS
New data
available
Customers using Lambda + Kinesis
Apply custom logic to process data
being uploaded through Kinesis
stream
Real-time
• Client activity tracking
analytics
Kinesis Stream • Metrics generation
AWS
Lambda • Data cleansing
Aggregate • Log filtering & routing
statistics • Indexing and searching
• Live alarms and notifications
Lambda Powered APIs
An API Call Flow
AWS
API Gateway
Cache
AWS Lambda
Mobile Apps functions
Internet Amazon
Websites Amazon
CloudFront
API Gateway
Endpoints on
Amazon EC2
Services
Any other publicly
Amazon CloudWatch accessible endpoint
Monitoring
Lambda + Cognito & Mobile Apps
Building Mobile Backends with Lambda
• Lambda as the backend logic for
mobile applications.
• Easy Personalization
• … for devices
• … for end users
Other Use Cases
Scheduled Events (CRON)
• Dev/QA Environments: Stop running
instances at 19:00 h and Start it again at
8:00 between Monday to Friday.
• Log cleanup
• Batching up statistics
• Alarm clock
• Infrastructure automation
• Backup scheduler
Backup and Disaster Recovery
• Cross-region replication to multiple
regions.
• Off-site backups.
• Validation of those backups is difficult to
scale.
• Set rules on Lambda that defines what
needs to be backup and checks
• Validates and raise alarms in case of
failure.
Amazon ALEXA
Natural Language Understanding (NLU) &
(It’s what’s inside Alexa)
Automatic Speech Recognition (ASR) Powered By Deep Learning
Natural Language Understanding (NLU) &
Automatic Speech Recognition (ASR) Powered By Deep Learning
Amazon Lex - Technology
AWS Services
Multi-Platform Clients:
Mobile, IoT, Web,
Chat Cognito CloudTrail CloudWatch
SDK Output:
Speech (via Polly TTS) Authentication
Input: or Text & Visibility
Speech
End-Users or Text
Amazon Lex Action
AWS Lambda
Fulfillment
Intents,
Slots,
Prompts,
Console Utterances
Speech Language
API API
API
Automatic Speech Natural Language
Recognition (ASR) Understanding (NLU)
Developers
Same technology that powers Alexa
Thank You
IanMmmm Mr Rio
ianm@amazon.com james@parall.ax