![Page 1: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/1.jpg)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Johnathon Meichtry, Principal Solutions Architect, Amazon Web Services
Curdin Krummenacher, Web Development Lead, Te Papa
Jeremy Cook, Principal Solutions Architect, Fronde
Getting Started with AWS Lambda and
the Serverless Cloud
Technical 201
![Page 2: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/2.jpg)
Business
101 Technical
201 Technical
301 Technical
401 Technical
Session Depth
![Page 3: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/3.jpg)
Apps Without Servers
What’s the easiest server to manage?
The one somebody else takes care of!
![Page 4: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/4.jpg)
Five Sample Use Cases for AWS Lambda
Serverless
Microservices
Adding a
Feature to
Amazon S3
Extending
Platforms
Scalable
Mobile
Backends
Real-Time
Streaming
Analysis
![Page 5: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/5.jpg)
Requirements
• Effortless scaling / no provisioning
• Built-in rollout
• Highly available by default
• Bring Your Own Code (BYOC)
• Never pay for idle
![Page 6: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/6.jpg)
A Scalable Mobile Backend
![Page 7: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/7.jpg)
A Scalable Mobile Backend…
Without Coding the Mobile
Backend
![Page 8: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/8.jpg)
Building a Mobile Backend with AWS Lambda
1. Create an Amazon
DynamoDB database.
2. Pick the “Simple Mobile Backend”
sample code in the Lambda console.
3. Build your app with the AWS Mobile SDK.
Let’s see it in action…
AWS Lambda
![Page 9: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/9.jpg)
Building a Mobile Backend: Add-ons
Want users to log in?
Use Amazon Cognito Identity.
Need device-specific rendering?
Device info is in the function’s context object.
AWS Lambda
![Page 10: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/10.jpg)
What Makes This Easy?
Eliminating the distance between
“Works on my box” and “Ship it to customers!”
Never Pay
for Idle
Built-In
Web Server
Auto Patch
Auto
Deploy
Auto ScaleBuilt-In
Monitoring
Built-In
Logging
Built-In
Security
HTTP
Endpoint
![Page 11: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/11.jpg)
Diving Deeper: Programming Model
Three main languages• Node.js
• Java 8
• Python
Plus Scala, Clojure, and other “jvm” languages
Run background processes• Node.js or Java or Python
• Also Python, csh, or your own executable
Native libraries are welcome!
![Page 12: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/12.jpg)
Serverless Microservices
![Page 13: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/13.jpg)
HTTP Endpoints
Let’s see it in action…
![Page 14: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/14.jpg)
SquirrelBin Architecture
Static web
content served
from
Amazon S3
“Codeless”
Backend +
Acorn Execution
Acorns Stored
in Amazon
DynamoDB
![Page 15: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/15.jpg)
New Capabilities for AWS Lambda Functions
• Public HTTP endpoints
• Throttling controls
• API Key management
• Results caching
• SDK Generation and Swagger support
• Apache Velocity templates
• API mocking
![Page 16: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/16.jpg)
Diving Deeper: Programming Model
Run your code sync or async from…
• Any AWS SDK
• AWS Mobile SDK
• REST call
• AWS Command Line Interface
• Inside AWS Lambda itself (yep, it self-hosts)
Code is pre-credentialed
• Choose a role and Lambda will assume it for you
• Cross account access is supported
![Page 17: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/17.jpg)
Extending Other Platforms
![Page 18: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/18.jpg)
Compute for Connected Devices
Alexa Skills Kit – build voice-
enabled apps
Uses AWS Lambda as a
connected device/IoT platform
![Page 19: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/19.jpg)
Slack Demo Architecture
Alexa, tell Slack to
send, “I’m giving the
demo now.”
Message Retrieval
(via Amazon SQS
queue)
Kevin says,
“Break a leg!”
Message Upload (via
Slack API)
Team
(channel users)
Slack
![Page 20: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/20.jpg)
GitHub Event Responder
Events from GitHubTeam
(repository users)
GitHub
Amazon SNS
Messages
![Page 21: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/21.jpg)
![Page 22: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/22.jpg)
CloudWatch
Scheduled Event
EveryDay1235pmNZT
Deactivation
Report Email
via SES SysOps
IAM Access KeysIAM Users
Triggers
Queries/Updates
Generates Delivers
![Page 23: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/23.jpg)
The Access Key
[***************A4B4Q]
belonging to User
[Logstash] has been
automatically deactivated
due to it being 50 days old.
![Page 24: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/24.jpg)
PyCharm IDE
Python 2.7
Boto3
Grunt
JavaScript
Task runner
IAM Role
IAM Policy
Lambda Function
CloudWatch
Scheduled Event
GitHub
![Page 25: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/25.jpg)
![Page 26: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/26.jpg)
![Page 27: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/27.jpg)
![Page 28: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/28.jpg)
What Makes This Easy?
Nothing to host
Nothing to license
No capacity management
No web service to run
Low latency sync calls
“Fire and forget” events
Low cost
Forever free tier
No infrastructure
No “boilerplate” code
Language choice
No library restrictions
For the App DeveloperFor the Platform Provider
![Page 29: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/29.jpg)
Diving Deeper: Resource Sizing
AWS Lambda offers 12 “power levels”
Higher levels offer more memory and more CPU power
• 128 MB, lowest CPU power
• 1.5 GB, highest CPU power
Higher power levels == lower latency for CPU-bound and
bursty tasks
Compute price scales with the power level
![Page 30: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/30.jpg)
Extending Amazon S3
![Page 31: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/31.jpg)
Extending Amazon S3 with Auto-Compress
Amazon S3 Bucket Events AWS Lambda
Original object Compressed object
1
2
3
![Page 32: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/32.jpg)
How to Add a Feature to Amazon S3
1. Grab Java compress sample from the web.
2. Start with the Amazon S3 event sample:1. GET original from S3
2. Compress
3. PUT compressed version back to S3
3. Pick some S3 bucket(s) to apply it to.
Let’s see it in action…
![Page 33: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/33.jpg)
What Makes This Easy? Request-Level Scaling!
• Who knows the event
rate? S3 and Lambda!
• You can’t over or under
provision (by design)
• Pay only for what you use
![Page 34: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/34.jpg)
AWS Services You Can Extend Today
Amazon
S3
Amazon
DynamoDB
AWS
CloudTrail
Amazon
CloudWatch
Logs
AWS
CloudFormation
Amazon
Kinesis
Amazon
Cognito
Amazon
SNS
![Page 35: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/35.jpg)
Amazon CloudWatch Alarm Responder
Amazon
CloudWatch
Alarms
SNS Messages
![Page 36: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/36.jpg)
Real-Time Streaming Analysis
![Page 37: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/37.jpg)
Easy Real-Time Streaming Architecture
Data Ingestion
with Amazon
Kinesis
(PUT record)
Records retrieved
by AWS Lambda
Your code runs
once per [batch of]
records
Amazon S3
Amazon
DynamoDB
Smart Devices
Click
Stream
Log
Data
Amazon
Redshift
Learn more: Watch the Lambda Webinar on Streaming Data
![Page 38: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/38.jpg)
Diving Deeper: Retries and Event Ordering
Three possibilities:1. Call your AWS Lambda function synchronously.
• Using the AWS SDK? Set your retry logic there.
• Direct RESTful call to Lambda? You control retries entirely.
• Ordering is up to the caller.
2. Amazon S3 or SNS trigger your Lambda function, or you call Lambda asynchronously.• 3 tries, total, then the event is discarded
• Unordered (“loosely ordered”)
3. Lambda polls an Amazon Kinesis or Amazon DynamoDB update stream for you• No limit on tries, ordering preserved
![Page 39: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/39.jpg)
Aside: Shards and Ordering
Shard 1
• Record 1a
• Record 1b
![Page 40: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/40.jpg)
Aside: Shards and Ordering
Shard 1
• Record 1a
• Record 1b
Shard 2
• Record 2a
• Record 2b
Shard 3
• Record 3a
• Record 3b
![Page 41: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/41.jpg)
Aside: Shards and Ordering
Shard 1 Shard 2 Shard 3
• Record 3a
• Record 3b
![Page 42: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/42.jpg)
Practicalities
![Page 43: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/43.jpg)
AWS Lambda Regions
AWS Lambda
Region NEW: Sydney
![Page 44: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/44.jpg)
Fine-grained pricing
• Buy compute time in
100 ms increments
• Low request charge
• No hourly, daily, or monthly
minimums
• No per-device fees
Never pay for idle.
Free Tier
1 million requests and 400,000 GBs
of compute.
Every month, every customer.
![Page 45: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/45.jpg)
Build and Deploy Integration
Jenkins Grunt
AWS
CloudFormation
Amazon S3
Partners
![Page 46: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/46.jpg)
Function Versioning
How it works:
• Develop at HEAD—updates replace existing code
• Publish to create an immutable snapshot
• Every function has a default version (which can be HEAD)
• Callers can request
• The default version
• A specific version
• HEAD
APIs support staging and versioning (now)
![Page 47: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/47.jpg)
We’ve Been Busy.
Now, It’s Your Turn.
![Page 48: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/48.jpg)
Go to the AWS Lambda console, create
a function, and run it.(The first million invokes are on us!)
![Page 49: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/49.jpg)
Congrats, you’re a Lambda function
expert! Add an event source or an
HTTP endpoint.
![Page 50: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/50.jpg)
Build the world’s easiest mobile backend.(Hint: Start with the built-in CRUD sample!)
![Page 51: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/51.jpg)
Next Steps
• How to Get Started
• AWS Documentation
• Getting Started Guide
• Follow AWS Lambda!
aws.amazon.com/blogs/compute
aws.amazon.com/lambda
AWS Lambda Forum
![Page 52: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/52.jpg)
AWS Training & Certification
Intro Videos & Labs
Free videos and labs to
help you learn to work
with 30+ AWS services
– in minutes!
Training Classes
In-person and online
courses to build
technical skills –
taught by accredited
AWS instructors
Online Labs
Practice working with
AWS services in live
environment –
Learn how related
services work
together
AWS Certification
Validate technical
skills and expertise –
identify qualified IT
talent or show you
are AWS cloud ready
Learn more: aws.amazon.com/training
![Page 53: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/53.jpg)
Your Training Next Steps:
Visit the AWS Training & Certification pod to discuss your
training plan & AWS Summit training offer
Register & attend AWS instructor led training
Get Certified
AWS Certified? Visit the AWS Summit Certification Lounge to pick up your swag
Learn more: aws.amazon.com/training
![Page 54: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/54.jpg)
![Page 55: AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud](https://reader031.vdocuments.us/reader031/viewer/2022030317/586fb4171a28abe57d8b6fe7/html5/thumbnails/55.jpg)
Thank You!