AWS Lambda is a compute service that runs your code in response to triggers and automatically manages the compute resources for you. Amazon API Gateway is a fully managed service that makes it easy for developers to publish, maintain, monitor, and secure APIs at any scale.
This webinar will familiarize you with the basics of AWS Lambda and Amazon API Gateway and demonstrate how to build mobile backends using these services. You will learn how to set up API endpoints that trigger AWS Lambda functions to handle mobile API requests. You will also learn how to use Lambda to read and write to DynamoDB.
Learning Objectives:
Understand key AWS Lambda and Amazon API Gateway features
Learn how to set up a mobile backend using Amazon API Gateway and AWS Lambda
Explore sample use cases, best practices and tips on using AWS Lambda with Amazon API Gateway
Who Should Attend:
Developers, devops engineers, mobile developers
2. 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
3. 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
4. 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
5. Continuous ScalingNo 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
6. 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
7. 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
8.
9.
10. CRUD operations with DynamoDB
‘echo’ and ‘pong’ for testing
Error handling for incorrect inputs
Execute the operation with the event payload
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23. Architectural pattern for a simple three-tier application
Recommended whitepaper
AWS Serverless Multi-Tier Architectures
https://d0.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Architectures.pdf
24. Reference Architecture: Mobile backend using Amazon
API Gateway and AWS Lambda
https://s3.amazonaws.com/awslambda-reference-architectures/mobile-backend/lambda-refarch-mobilebackend.pdf
25. 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/
26. 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.
27. 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.