Upload
amazon-web-services
View
5.764
Download
0
Embed Size (px)
Citation preview
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tara E. Walker
Technical Evangelist
Amazon Web Services
An Introduction to AWS Lambda
Serverless Cloud
AWS Compute offerings
LambdaServerless compute
platform for stateless
code execution in
response to Triggers
ECSContainer
management service
for running Docker on
a managed cluster of
EC2
EC2Virtual servers
in the Cloud
AWS Lambda Overview
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
November 13, 2014
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
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
Lambda update: 5 new features announced
earlier this month at re:Invent 2015
1. Python functions
2. Increased function duration
3. Function versioning & aliasing
4. Scheduled functions (Cron)
5. Accessing Resources in a VPC From a Lambda Function
[coming soon]
Details at: https://aws.amazon.com/blogs/aws/aws-lambda-update-
python-vpc-increased-function-duration-scheduling-and-more/
New Feature: Python 2.7
Demo:
Python 2.7 - Hello World
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
Demo:
Scheduled Function - Canary
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
Sneak Peek: Accessing Resources in a VPC
From a Lambda Function [Coming soon]
Description: Access resources behind a VPC from inside
Lambda functions
Benefit: You will soon be able to access resources in a
private IP range in your VPC, including EC2, ELB, RDS,
ElastiCache and Redshift
How it works: When creating Lambda functions, you will be
able to select the VPC subnets and security groups, and the
Lambda function executions can then access private
endpoints in that VPC IP range
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.
Thank you!
Follow me on Twitter @taraw
Follow AWS Lambda!
aws.amazon.com/blogs/compute
aws.amazon.com/lambda
AWS Lambda Forum