aws december 2015 webinar series - build mobile backends with aws lambda and amazon api gateway

27
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda Q&A Moderator: Stefano Buliani, Sr. Product Manager, Amazon API Gateway Q&A Moderator: Aaron Kao, Sr. Product Marketing Manager, Microservices December 10 th , 2015 Build Mobile Backends with AWS Lambda and Amazon API Gateway

Upload: amazon-web-services

Post on 14-Apr-2017

2.224 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda

Q&A Moderator: Stefano Buliani, Sr. Product Manager, Amazon API Gateway

Q&A Moderator: Aaron Kao, Sr. Product Marketing Manager, Microservices

December 10th, 2015

Build Mobile Backends with AWS Lambda and Amazon API Gateway

Page 2: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Amazon API Gateway: A fully managed service for running APIs at scale

Build, Deploy, and Manage APIs

Throttling rules per HTTP method

Cache with customizable keys

Multiple API versions and stages

Generate client SDKs

Dashboard for visual monitoring

Flexible authorization model

API Keys for 3rd party developers

Page 3: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Benefits of API Gateway for building mobile backends

Low cost and efficient

Performance at any scale

Easily monitor API activity

Streamline API development

Flexible security controls

Create RESTful Endpoints

Page 4: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

AWS Lambda: A compute service that runs your code in response to events

Lambda functions: Stateless, trigger-based code execution

Triggered by events:• Direct Sync and Async invocations • Put to an Amazon S3 bucket• API Gateway call• And many more …

Makes it easy to• Build back-end services that perform at scale • Perform data-driven auditing, analysis, and notification

Page 5: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Continuous Scaling No Servers to Manage

AWS Lambda automatically scales your application by running code in response to each trigger. Your code runs in parallel and processes each trigger individually, scaling precisely

with the size of the workload.

Subsecond Metering

With AWS Lambda, you are charged for every 100ms your code executes and the number of times your code is

triggered. You don't pay anything when your code isn't running.

AWS Lambda automatically runs your code without requiring you to provision or manage servers. Just write the code

and upload it to Lambda.

Benefits of AWS Lambda for building mobile backends

1 2 3

Page 6: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

API Gateway + Lambda = Frontend + Backend !

Internet

Mobile Apps

Websites

Services

API Gateway

AWS

API Gateway Cache

Endpoints on Amazon EC2

Any other publicly accessible endpoint

Amazon CloudWatch Monitoring

Amazon CloudFront

AWS Lambda functions

Page 7: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Walkthrough of a simple CRUD backend with a RESTful API endpoint using AWS Lambda

Amazon API Gateway

AWS Lambda Amazon DynamoDB

API call from client app

Request/Response CRUD Operations

Page 8: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 9: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 10: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

CRUD operations with DynamoDB

‘echo’ and ‘pong’ for testing

Error handling for incorrect inputs

Execute the operation with the event payload

Page 11: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 12: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 13: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 14: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 15: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 16: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 17: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 18: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 19: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 20: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 21: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 22: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway
Page 23: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Architectural pattern for a simple three-tier application

Recommended whitepaperAWS Serverless Multi-Tier Architectures

https://d0.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Architectures.pdf

Page 24: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Reference Architecture: Mobile backend using Amazon API Gateway and AWS Lambda

https://s3.amazonaws.com/awslambda-reference-architectures/mobile-backend/lambda-refarch-mobilebackend.pdf

Page 25: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Sample code: Mobile backend using Amazon API Gateway and AWS Lambda

CloudFormation templates

Template One configures

• Amazon S3

• Amazon CloudFront

• Amazon DynamoDB

Template Two creates

• 3 different AWS Lambda functions

• AWS IAM roles and policies

Setup instructions

• Deploy setup using Template One

• Create CloudSearch domain

• Update environment variables in the

Lambda function code

• Upload Lambda function code to S3

and Deploy using Template Two

• Link DynamoDB table as event source

https://github.com/awslabs/lambda-refarch-mobilebackend/

Page 26: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Three Next Steps

1. Create and test your first API. With a few clicks in the AWS Management Console, you can create an API that acts as a “front door” for applications to access data, business logic, or functionality from your back-end services.

2. Create and test your first Lambda function. With AWS Lambda, there are no new languages, tools, or frameworks to learn. You can use any third party library, even native ones.

3. Select Lambda as your backend for your API … Use the sample code and setup instructions to quickly create your first mobile backend using Amazon API Gateway and AWS Lambda.

Page 27: AWS December 2015 Webinar Series - Build Mobile Backends with AWS Lambda and Amazon API Gateway

Thank you!

Visit http://aws.amazon.com/api-gateway, the AWS blog, and the API Gateway forum to learn more and get started using API Gateway.

Visit http://aws.amazon.com/lambda, the AWS Compute blog, and the Lambda forum to learn more and get started using Lambda.