Advertisement
Advertisement

More Related Content

Slideshows for you(20)

Advertisement

Similar to AWS August Webinar Series - Building Serverless Backends with AWS Lambda and Amazon API(20)

More from Amazon Web Services(20)

Advertisement

AWS August Webinar Series - Building Serverless Backends with AWS Lambda and Amazon API

  1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda Q&A Moderator: Ajay Nair, Sr. Product Manager, AWS Lambda August 18th, 2015 Best Practices: Building Serverless Backends with AWS Lambda and Amazon API Gateway
  2. Amazon API Gateway: Build, Deploy, and Manage APIs SDK Generation for iOS, Android and JavaScript Create and distribute API Keys to developers Leverage AWS Sigv4 to authorize access to APIs Swagger support Utilizes AWS Lambda Request / Response data transformation
  3. Benefits of API Gateway for creating RESTful endpoints for deploying services Manage deployments to multiple versions and environments Define and host APIs Leverage Identity and Access Management to authorize access to your cloud resources Leverage AWS Auth DDoS protection and request throttling to safeguard your backend Manage network traffic 1 2 3
  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. High performance at any scale; Cost-effective and efficient No Infrastructure to manage Pay only for what you use: Lambda automatically matches capacity to your request rate. Purchase compute in 100ms increments. Bring Your Own Code “Productivity focused compute platform to build powerful, dynamic, modular applications in the cloud” Run code in a choice of standard languages. Use threads, processes, files, and shell scripts normally. Focus on business logic, not infrastructure. You upload code; AWS Lambda handles everything else. Benefits of AWS Lambda for building a server-less data processing engine 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. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  9. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  10. CRUD operations with DynamoDB ‘echo’ and ‘pong’ for testing Error handling for incorrect inputs Remove operation code from event
  11. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  12. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  13. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  14. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  15. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  16. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  17. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  18. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  19. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  20. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  21. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  22. AWS Console walkthrough of a simple CRUD backend with a RESTful API endpoint using Lambda
  23. Demo site: A simple CRUD backend with a RESTful API endpoint using Amazon API Gateway and AWS Lambda http://squirrelbin.com/
  24. Attaching Lambda functions to RESTful HTTP Endpoints • 1:1 Mapping: Every API call triggers a stateless Lambda function • Add caching to API calls to return a cached response instead for duplicate requests • API Gateway concepts: An API is defined as a set of resources and methods • Resource: A logical entity that can be accessed within an API • Method: The combination of a resource path and an HTTP verb such as GET/POST • Automatic Scaling: Both API Gateway and Lambda scale automatically with calls • Safety throttle of 100 concurrent Lambda functions, can be increased by AWS Support Center • User defined standard-rate limit and a burst-rate limit per second for each API method
  25. Best practices for creating Lambda functions • Memory: CPU proportional to the memory configured • Increasing memory makes your code execute faster (if CPU bound) • Timeout: Increasing timeout allows for longer functions, but more wait in case of errors • Retries: For API Gateway, Lambda doesn’t retry the function execution, but the Gateway generated SDKs retry throttled requests • Permission model: API Gateway synchronously triggers Lambda, so assign API Gateway a resource policy to invoke Lambda.
  26. Monitoring and Debugging Lambda functions • Console Dashboard • Lists all Lambda functions • Easy editing of resources, event sources and other settings • At-a-glance metrics • Metrics in CloudWatch • Requests • Errors • Latency • Throttles • Logging in CloudWatch Logs
  27. Using API Gateway Input/Output Transforms Filter output results • Remove private or unnecessary data • Filter dataset size to improve API performance GET to POST • Read all query string parameters from your GET request, and create a body to make a POST to your backend JSON to XML • Receive JSON input and transform it to XML for your backend • Receive JSON from a Lambda function and transform it to XML
  28. Managing different versions of your API stack • Operate multiple API versions and multiple stages for each version simultaneously • Clone an existing API to start working on the next major version • Set up custom domain names to point directly to a stage • Version Lambda functions, and associate API stage with Lambda function version alias COMING SOON!
  29. 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 … This gives you an endpoint for your function which can respond to REST calls like GET, PUT and POST without managing any servers.
  30. 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.
  31. AWS re:Invent 2015 – October 6-9 AWS re:Invent is the largest annual gathering of the global cloud community. Whether you are an existing customer or new to the cloud, AWS re:Invent will provide you with the knowledge and skills to refine your cloud strategy, improve developer productivity, increase application performance and security, and reduce infrastructure costs. Though AWS re:Invent tickets are sold out, you can still register to view the Live Stream Broadcasts of the keynote addresses and select technical sessions on October 7 and October 8. Register now. Details: Wednesday, October 7 9:00am - 10:30am PT: Andrew Jassy, Sr. Vice President, AWS 11:00am - 5:15pm PT: 5 of the most popular breakout sessions (to be announced) Thursday, October 8 9:00am - 10:30am PT: Dr. Werner Vogels, CTO, Amazon 11:00am - 6:15pm PT: 6 of the most popular breakout sessions (to be announced) Register now for the Live Stream Broadcast by submitting your email where prompted on the AWS re:Invent home page. Stay Connected: Follow event activities on Twitter @awsreinvent (#reinvent), or like us on Facebook.
Advertisement