Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Amazon API Gateway and AWS Lambda: Better Together

2,182 views

Published on

Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. AWS Lambda is a compute service that runs your code in response to events and automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information. Together they help you build a server-less event-driven backend that is easy to manage and scale.

Published in: Software
  • Be the first to comment

Amazon API Gateway and AWS Lambda: Better Together

  1. 1. Amazon API Gateway and AWS Lambda: Better Together Danilo Poccia AWS Technical Evangelist @danilop danilop
  2. 2. You Want to Build Your Brand New Application
  3. 3. Application
 +
 Data
  4. 4. Application
 +
 Data Websites Mobile
 Apps Wearable
  5. 5. Application Data Websites Mobile
 Apps Wearable
  6. 6. Application Files DB Content +
 Some API Calls API Calls Websites Mobile
 Apps Wearable
  7. 7. Application Files DB API Calls Websites (JavaScript Apps) Mobile
 Apps Wearable JavaScript API Calls
  8. 8. Application Files DB API Calls Websites (JavaScript Apps) Mobile
 Apps Wearable Services API Calls JavaScript API Calls
  9. 9. Application Files DB API Calls Websites (JavaScript Apps) Mobile
 Apps Wearable Services API Calls JavaScript Authentication
 & Authorization Caching & Throttling Business
 Logic API Calls
  10. 10. Application DB API Calls Websites (JavaScript Apps) Mobile
 Apps Wearable Services API Calls JavaScript Files Amazon S3 Amazon DynamoDB Authentication & Authorization Amazon
 Cognito Business Logic AWS
 Lambda Caching & Throttling Amazon API
 GatewayAPI Calls
  11. 11. How Does It Works?
  12. 12. X Authentication Providers End Users User
 Credentials Authentication
 Token Amazon Cognito
 Identity Broker Identity Pool Id (Token) Identity Id
 AWS Temp Credentials (Depending on
 Auth / Unauth Role) Access to
 AWS Services (Including Amazon
 API Gateway) Identity Id AWS Temp Credentials Amazon S3 Amazon
 DynamoDB Amazon
 Mobile Analytics Amazon Cognito
 Sync Store K / V Authentication & Authorization Amazon
 CognitoCheck Token
  13. 13. X End Users User
 Credentials Authentication
 Token Amazon Cognito
 Identity Broker Identity Pool Id (Token) Identity Id
 AWS Temp Credentials (Depending on
 Auth / Unauth Role) Access to
 AWS Services (Including Amazon
 API Gateway) Identity Id AWS Temp Credentials Amazon S3 Amazon
 DynamoDB Amazon
 Mobile Analytics Amazon Cognito
 Sync Store K / V Custom
 Authentication Service Get Token Token Authentication & Authorization Amazon
 Cognito
  14. 14. Amazon
 CloudFront API Gateway
 Cache Amazon
 CloudWatch Monitoring & Logs Endpoints on
 Amazon EC2 or AWS Elastic Beanstalk Internet Any other publicly
 accessible endpoint AWS Lambda
 Functions Caching & Throttling Amazon API
 Gateway X Access to
 API Method
  15. 15. Managed Cache to Store API Responses
 Reduced Latency and DDoS Protection through Amazon CloudFront
 SDK Generation for iOS, Android and JavaScript HTTP 429 Response for API Throttling (Managed by the SDK)
 Swagger Support
 Request / Response Data Transformation and API Mocking
  16. 16. Business Logic AWS
 Lambda AWS Lambda
 Functions Amazon
 API Gateway Amazon S3 Amazon
 DynamoDB Amazon Cognito
 Sync Store K / VAmazon
 SNS Amazon
 Kinesis Alexa Skills Kit (ASK) Alexa Voice Service (AVS) HTTPS
 Invoke Custom Events HTTPS
 REST API Call
  17. 17. console.log('Loading function'); exports.handler = function(event, context) { console.log('value1 =', event.key1); console.log('value2 =', event.key2); console.log('value3 =', event.key3); // Echo back the first key value context.succeed(event.key1); // context.fail('Something went wrong'); };
  18. 18. Build Back-end Services that Perform at Scale Respond Quickly to New Information Run Your Code without Managing Infrastructure Cost-effective and Efficient
  19. 19. Amazon API Gateway + AWS Lambda
  20. 20. Resource + HTTP Verb ➔ Method
  21. 21. Resource + HTTP Verb ➔ Method /books + GET ➔ GetAllBooks
  22. 22. Resource + HTTP Verb ➔ Method /books + GET ➔ GetAllBooks /books + POST ➔ CreateNewBook
  23. 23. Resource + HTTP Verb ➔ Method /books + GET ➔ GetAllBooks /books + POST ➔ CreateNewBook /books/{id} + GET ➔ GetBookById /books/{id} + PUT ➔ CreateOrUpdateBookById /books/{id} + DELETE ➔ DeleteBookById
  24. 24. Let’s Put Everything Together
  25. 25. Media Sharing Application
  26. 26. λ λ λ Amazon
 API Gateway λ λ λ λ Bucket Usage
 Table Media Metadata Table User Stat Table User
 Location Table K / V λ λ λ Amazon Cognito
 Identity Broker Amazon Cognito
 Sync Store Amazon
 SNS Amazon
 Kinesis Media
 Bucket Log Table Authentication & Authorization Upload Picture / VideoUpdate Bucket UsageCheck Bucket Usage Delete “Over Quota” Media Send Notification to User / Application Extract Metadata and Write on DB Update User Statistics Call REST API to Get Media Description Upload Location Info Update User Location Look for Users or Media Near Current Location Call REST API to Get User Info Sync Media and User Rating Write History of Changes Check and Update Ratings Invoke Read Write / Send
  27. 27. λ λ λ λ λ λ λ λ λ λ
  28. 28. Microservice Architecture λλ λλ λλ λλ λ λ
  29. 29. Focus on You Idea
  30. 30. aws.amazon.com/free
  31. 31. Amazon API Gateway and AWS Lambda: Better Together Danilo Poccia AWS Technical Evangelist @danilop danilop

×