2016 Utah Cloud Summit: AWS Lambda and API Gateway

Download 2016 Utah Cloud Summit: AWS Lambda and API Gateway

Post on 07-Jan-2017

329 views

Category:

Technology

0 download

TRANSCRIPT

PowerPoint Presentation

LambdaJordan Farrer, 1Strategy

2016, 1Strategy, All rights reserved

1

What is Lambda?Event-driven managed compute serviceStateless code execution, no affinity to underlying infrastructureAnnounced November 2014

2

Benefits of LambdaRun code without managing serversInfinitely scalableBuilt-in high availabilityPay only for what you useZero administration

Sample Scenario

The Traditional Approach

Availability Zone

Availability Zone

Auto Scaling groupAuto Scaling group

The Traditional Approach - ResponsibilitiesApplication CodeInfrastructure ProvisioningOS patchingSecurityServer bootstrappingCode deploymentMonitoringScaling (manual or autoscaling)Fault Tolerance/High Availability

The Lambda Solution

The Lambda Solution - ResponsibilitiesApplication Code

Function Basics

CodePermissionsEvent

9

Lambda Function CodeExecution EnvironmentRuns on Amazon LinuxAWS SDK included by defaultAvailable RuntimesNode.jsPython 2.7Java 8Bring your own librariesNative library support

Lambda Function PermissionsIAM RoleBest Practice: Never hardcode username/password or Access/Secret keysSpecify granular permissions for each function to other AWS resourcesS3DynamoDBKinesisComing Soon: VPC

Lambda Event SourcesS3

Kinesis

DynamoDB

SNS

SES

CloudWatch Logs

CloudFormation

Scheduled

Alexa Skills Kit

12

Lambda MonitoringBuilt in to LambdaCloudWatch MetricsInvocation CountDurationError RateLogs recorded to CloudWatch Logs

Demo: Lambda

Create EC2 instances firstCreate IAM RoleCreate Lambda functionDemo CloudWatch 14

Example Use Case:Security Group Change Notifications

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

15

Lambda PricingPricing based on memory allocation and number of requestsCPU, network I/O, disk I/O determined by memory allocationBilled in 100ms incrementsNo hourly, daily, or monthly minimumsFree Tier400,000 GB-seconds every month

16

Sample Cost Comparison AssumptionsSample Scenario1 million requests1 second processing time per requestHighly-Available

Sample Cost ComparisonUsing EC22x t2.micro$0.013/hour * 750 hoursTotal: $19.50

Using Lambda1,000,000 requestsFirst million requests are free1,000,000 GB-seconds400,000 GB-seconds are free600,000 * $0.000001667 per 100msTotal: $10

18

API Gateway

API Gateway OverviewCreate, publish, maintain, monitor and secure APIsWorks with EC2, Lambda, or any web application as the backendPay only for what you use

API Gateway and LambdaBuilt-in controls for throttlingAutomatic monitoring through CloudWatchAPI VersioningUsing LambdaAPI Gateway becomes an Event Source

21

Demo: API Gateway

Thank You