(cmp301) aws lambda and the serverless cloud

34
© 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

Upload: amazon-web-services

Post on 16-Apr-2017

2.976 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: (CMP301) AWS Lambda and the Serverless Cloud

© 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

Page 2: (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!

Page 3: (CMP301) AWS Lambda and the Serverless Cloud

AWS Lambda – Benefits

EVENT-DRIVEN SCALESERVERLESS SUBSECOND BILLING

Page 4: (CMP301) AWS Lambda and the Serverless Cloud

AWS Lambda – How It Works

DEPLOYMENT

AUTHORING

MONITORING & LOGGING

STATELESS

Page 5: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 6: (CMP301) AWS Lambda and the Serverless Cloud

AWS Lambda – Partner Blueprints

Page 7: (CMP301) AWS Lambda and the Serverless Cloud

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…

Page 8: (CMP301) AWS Lambda and the Serverless Cloud

In case you missed it…

Page 9: (CMP301) AWS Lambda and the Serverless Cloud

Amazon Simple Email Service Inbound Rules

// Spam check

if (sesNotification.receipt.spamVerdict.status === 'FAIL‘ ||

sesNotification.receipt.virusVerdict.status === 'FAIL')

console.log('Dropping spam');

Page 10: (CMP301) AWS Lambda and the Serverless Cloud

Amazon CloudWatch Logs Processing

Scan, audit, or index log entries in near real time

AWS LambdaAmazon CloudWatch

Logs

Amazon

DynamoDB

Amazon S3

Amazon

Redshift

Page 11: (CMP301) AWS Lambda and the Serverless Cloud

New Feature: Python 2.7

Page 12: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 13: (CMP301) AWS Lambda and the Serverless Cloud

New Feature: Longer-running Functions

Page 14: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 15: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 16: (CMP301) AWS Lambda and the Serverless Cloud

New Feature: Scheduled Functions

Page 17: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 18: (CMP301) AWS Lambda and the Serverless Cloud

New Feature: Versioning

Page 19: (CMP301) AWS Lambda and the Serverless Cloud

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”);}

Page 20: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 21: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 22: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 23: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 24: (CMP301) AWS Lambda and the Serverless Cloud

New Feature: IoT Backends

Page 25: (CMP301) AWS Lambda and the Serverless Cloud

AWS IoT + AWS Lambda

Page 26: (CMP301) AWS Lambda and the Serverless Cloud

Sneak Peek: VPC Access

Page 27: (CMP301) AWS Lambda and the Serverless Cloud

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

Page 28: (CMP301) AWS Lambda and the Serverless Cloud

We’ve been busy.

Now it’s your turn.

Page 29: (CMP301) AWS Lambda and the Serverless Cloud

Go to the AWS Lambda console,

create a function, and run it.(The first million invokes are on us!)

Page 30: (CMP301) AWS Lambda and the Serverless Cloud

Congrats, you’re a Lambda

function expert! Add an event

source or an HTTP endpoint.

Page 31: (CMP301) AWS Lambda and the Serverless Cloud

Build a mobile, voice, or IoT

backend with a few lines of

code. Shazam!

Page 32: (CMP301) AWS Lambda and the Serverless Cloud

Remember to complete

your evaluations!

Please complete the session evaluation and tell us what you think.(I read every comment!)

Page 33: (CMP301) AWS Lambda and the Serverless Cloud

Thank you!

Follow AWS Lambda!

aws.amazon.com/blogs/compute

aws.amazon.com/lambda

AWS Lambda Forum

Page 34: (CMP301) AWS Lambda and the Serverless Cloud

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.