aws lambda and the serverless cloud -pop-up loft
TRANSCRIPT
AWSLambdaandtheServerlessCloudRan Tessler, AWS Solu0ons Architecture Manager
AWS Lambda – No Infrastructure to Manage
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 SCALE SERVERLESS SUBSECOND BILLING
AWS Lambda – Pricing
• Requests • $0.20 per 1 million requests • First 1 million requests per month are FREE
• Duration • $0.00001667 for every GB-second used. • Rounded up to the nearest 100ms • 400,000 GB-seconds of compute time per month are FREE
AWS Lambda – How It Works
DEPLOYMENT
AUTHORING
MONITORING & LOGGING
STATELESS
AWS Lambda Function
• Author your code • Node.js, Java 8, Python 2.7, native libraries
• Configure your runtime • Handler • Execution Role • Resource Sizing – 128MB up to 1.5GB • Timeout – 100ms up to 5min • Networking – VPC / Public
• Add event sources • Configure API endpoint
AWS Lambda - 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
AWS Lambda – Event Sources
Amazon S3 Amazon DynamoDB
Amazon Kinesis
AWS CloudTrail Amazon CloudWatch
Logs
AWS CloudFormation
Amazon SNS
AmazonSWF
AmazonSES
AmazonAPI Gateway
Amazon Cognito
November 13, 2014 Event Sources:
Integration with AWS Services:
AWS IoT
AWS Lambda – Partner Blueprints
In case you missed it…
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!
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: 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
dev Aliases
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
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: 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
Let’s get busy!
So what are we going to build today?
Voting Application
• A voting application • Fully serverless backend
• Votes stored and aggregated on DynamoDB using Lambda
• Static website on Amazon S3 and authentication using Cognito
• Email voting using SES Inbound Rules integration with Lambda
So what are we doing to build today?
So what are we doing to build today?
So what are we doing to build today?
So what are we doing to build today?
Ran Tessler AWS Solu0ons Architecture Manager [email protected]