Transcript
Page 1: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

©2016, 1Strategy, All rights reserved

LambdaJordan Farrer, 1Strategy

Page 2: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

What is Lambda?

• Event-driven managed compute service

• Stateless code execution, no affinity to underlying infrastructure

• Announced November 2014

Page 3: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Benefits of Lambda

• Run code without managing servers

• Infinitely scalable• Built-in high availability• Pay only for what you

use• Zero administration

Page 4: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Sample Scenario

Page 5: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

The Traditional Approach

Availability Zone

Availability Zone

Auto Scaling group Auto Scaling group

Page 6: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

The Traditional Approach - Responsibilities• Application Code• Infrastructure Provisioning• OS patching• Security• Server bootstrapping• Code deployment• Monitoring• Scaling (manual or autoscaling)• Fault Tolerance/High Availability

Page 7: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

The Lambda Solution

Page 8: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

The Lambda Solution - Responsibilities

• Application Code

Page 9: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Function Basics

Code Permissions Event

Page 10: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Lambda Function Code

• Execution Environment– Runs on Amazon Linux– AWS SDK included by default

• Available Runtimes– Node.js– Python 2.7– Java 8

• Bring your own libraries– Native library support

Page 11: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Lambda Function Permissions

• IAM Role– Best Practice: Never hardcode

username/password or Access/Secret keys

• Specify granular permissions for each function to other AWS resources– S3– DynamoDB– Kinesis

• Coming Soon: VPC

Page 12: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Lambda Event Sources

S3 Kinesis DynamoDB SNS SES

CloudWatch Logs CloudFormation Scheduled Alexa Skills Kit

Page 13: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Lambda Monitoring

• Built in to Lambda• CloudWatch

Metrics– Invocation Count– Duration– Error Rate

• Logs recorded to CloudWatch Logs

Page 14: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Demo: Lambda

Page 15: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Example Use Case:Security Group Change Notifications

http://www.1strategy.com/blog/security-group-change-notifications/

Page 16: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Lambda Pricing

• Pricing based on memory allocation and number of requests

• CPU, network I/O, disk I/O determined by memory allocation

• Billed in 100ms increments• No hourly, daily, or monthly

minimums• Free Tier

– 400,000 GB-seconds every month

Page 17: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Sample Cost Comparison Assumptions

Sample Scenario• 1 million requests• 1 second processing time per request• Highly-Available

Page 18: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Sample Cost Comparison

Using EC2• 2x t2.micro

– $0.013/hour * 750 hours• Total: $19.50

Using Lambda• 1,000,000 requests

– First million requests are free• 1,000,000 GB-seconds

– 400,000 GB-seconds are free– 600,000 * $0.000001667 per

100ms• Total: $10

Page 19: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

API Gateway

Page 20: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

API Gateway Overview

• Create, publish, maintain, monitor and secure APIs

• Works with EC2, Lambda, or any web application as the backend

• Pay only for what you use

Page 21: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

API Gateway and Lambda

• Built-in controls for throttling• Automatic monitoring through CloudWatch• API Versioning• Using Lambda

– API Gateway becomes an “Event Source”

Page 22: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Demo: API Gateway

Page 23: 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Thank You


Top Related