(cmp301) aws lambda and the serverless cloud
TRANSCRIPT
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dr. Tim Wagner, General Manager AWS Lambda
October 2015
CMP301
AWS Lambda and the
Serverless Cloud
AWS Lambda
A compute service where you
don’t have to think about:
• Servers
• Being over/under capacity
• Deployments
• Scaling and fault tolerance
• OS or language updates
• Metrics and logging
…but where you can easily
• Bring your own code…
even native libraries
• Run code in parallel
• Create backends, event
handlers, and data
processing systems
• Never pay for idle!
AWS Lambda – Benefits
EVENT-DRIVEN SCALESERVERLESS SUBSECOND BILLING
AWS Lambda – How It Works
DEPLOYMENT
AUTHORING
MONITORING & LOGGING
STATELESS
AWS Services Integrated with AWS Lambda
Amazon
S3
Amazon
DynamoDB
Amazon
Kinesis
AWS
CloudTrail
Amazon
CloudWatch
Logs
AWS
CloudFormation
Amazon
SNS
Amazon
SWF
Amazon
SES
Amazon
API Gateway
Amazon
Cognito
November 13, 2014
AWS Lambda – Partner Blueprints
Languages and Features
re:Invent 2014Preview Launch
April 2015GA
Summer 2015 re:Invent 2015
• Node.js
• Event handlers
• CORS
• Mobile
Backends
• Sync calls
• Resource
policies
• Java
• Amazon S3
uploads
• Blueprints
• 1.5 GB
• Tokyo region
• Alexa Skills
• …and…
In case you missed it…
Amazon Simple Email Service Inbound Rules
// Spam check
if (sesNotification.receipt.spamVerdict.status === 'FAIL‘ ||
sesNotification.receipt.virusVerdict.status === 'FAIL')
console.log('Dropping spam');
Amazon CloudWatch Logs Processing
Scan, audit, or index log entries in near real time
AWS LambdaAmazon CloudWatch
Logs
Amazon
DynamoDB
Amazon S3
Amazon
Redshift
New Feature: Python 2.7
Python 2.7 Support in AWS Lambda
• Available today in
• All SDKs (including mobile SDKs)
• AWS CLI
• Lambda console (including interactive editing)
• Includes
• Version 1.1.3 of boto3 (AWS Python SDK)
• Documentation and walkthroughs
• Console blueprints
New Feature: Longer-running Functions
Longer-running AWS Lambda Functions
• Run functions for up to 5 minutes
• Available today in the following SDKs
• Python (boto3)
• Java
• Node.js
• PHP
• AWS Mobile SDK for Android
• AWS Mobile SDK for iOS
Resource Sizing
• AWS Lambda offers 23 “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
• Duration ranging from 100ms to 5 minutes
• Free Tier: 1M free requests and 400,000 GB-s / month
New Feature: Scheduled Functions
Scheduled AWS Lambda Functions
• Available today in the Lambda console
• Schedule functions at a specific time or recurring
• Accepts standard cron syntax
• 5 minute granularity
• You can get sub-second granularity using a Lambda function
• Easily poll Amazon SQS or other data sources!
• Coming later in 2015: CLI, SDK support
New Feature: Versioning
Versioning: Development
Developing in AWS Lambda stays simple:
• Upload code
• Make changes any time
• Last update wins
exports.handler =
function(event,context)
{context.succeed(“bye”);}
exports.handler =
function(event,context)
{context.succeed(“hi”);}
Versioning: Publishing
Publish new versions from development at any time:
• “Copies” dev version to a numbered version
• Published versions are read-only (including configuration)
• Simple, integer counter per function
exports.handler =
function(event,context)
{context.succeed(“bye”);}
exports.handler =
function(event,context)
{context.succeed(“hi”);}1
2Versions
Versioning: Calling Lambda Functions
Development version:
FunctionName (or)
FunctionName:$LATEST
Specific version:
FunctionName:1
FunctionName:2
Named version:
FunctionName:production
FunctionName:v1_2_3_4
Versioning: Aliases
Create named aliases to any version:
• Allows function owner to map ARNs to code
• Can be updated without changing clients
exports.handler =
function(event,context)
{context.succeed(“bye”);}
exports.handler =
function(event,context)
{context.succeed(“hi”);}prod
devAliases
Amazon API Gateway:
Version your APIs
/prod/my_url_endpoint
MyFunction:prod_rel
Versioning APIs and Code
MyFunction:prod_rel
Function:3
{your code}
AWS Lambda:
Version your code
New Feature: IoT Backends
AWS IoT + AWS Lambda
Sneak Peek: VPC Access
AWS Lambda VPC Access
• Select the functions to run in your VPC
• Select subnets and security groups to use
• Your Lambda function can access the private resources
you choose:
• Amazon Elasticache
• Amazon RDS
• Private EC2 endpoints
• Any other resources in your VPC
• Launching later this year in all AWS Lambda regions
We’ve been busy.
Now it’s your turn.
Go to the AWS Lambda console,
create a function, and run it.(The first million invokes are on us!)
Congrats, you’re a Lambda
function expert! Add an event
source or an HTTP endpoint.
Build a mobile, voice, or IoT
backend with a few lines of
code. Shazam!
Remember to complete
your evaluations!
Please complete the session evaluation and tell us what you think.(I read every comment!)
Thank you!
Follow AWS Lambda!
aws.amazon.com/blogs/compute
aws.amazon.com/lambda
AWS Lambda Forum
Related Sessions
Up next at 5:30pm in Palazzo N:
ARC308 – The Serverless Company Using AWS Lambda:
Streamlining Architecture with AWS
featuring PlayOn! Sports
You can find all AWS Lambda-related content after the
conference on the AWS Compute blog.