© 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
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
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
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
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
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
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
CRUD operations with DynamoDB
‘echo’ and ‘pong’ for testing
Error handling for incorrect inputs
Execute the operation with the event payload
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
Reference Architecture: Mobile backend using Amazon API Gateway and AWS Lambda
https://s3.amazonaws.com/awslambda-reference-architectures/mobile-backend/lambda-refarch-mobilebackend.pdf
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/
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.
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.
Top Related