Вы находитесь на странице: 1из 11

Amazon API Gateway

APIs at any scale


Danilo Poccia, Technical Evengelist
@danilop danilop

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
A new, fully managed model
AWS

Internet AWS Lambda Other AWS


Mobile apps API Gateway functions services
A new, fully managed model
AWS

Internet AWS Lambda Other AWS


Mobile apps API Gateway functions services

Managed

AWS Lambda
API Gateway
functions
cache

Any other publicly


accessible endpoint
Amazon API
CloudFront Gateway
Endpoints on
Amazon Amazon EC2
CloudWatch
Web API to Lambda Functions Mapping

Resource + HTTP Verb ➔ Method


Web API to Lambda Functions Mapping

Resource + HTTP Verb ➔ Method

/books + GET ➔ GetAllBooks


Web API to Lambda Functions Mapping

Resource + HTTP Verb ➔ Method

/books + GET ➔ GetAllBooks

/books + POST ➔ CreateNewBook


Web API to Lambda Functions Mapping

Resource + HTTP Verb ➔ Method

/books + GET ➔ GetAllBooks

/books + POST ➔ CreateNewBook

/books/{id} + GET ➔ GetBookById

/books/{id} + PUT ➔ CreateOrUpdateBookById

/books/{id} + DELETE ➔ DeleteBookById


Input/output transforms
Use Velocity templates to transform data

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 back end

JSON to XML
• Receive JSON input and transform it to XML for your back end
• Receive JSON from a Lambda function and transform it to XML
Transform example: JSON to XML
API Gateway
Back end
Lambda
GET - /sayHello
fn_sayHello

{
<xml> “message” : “Hello world”
<message> }
Hello world
</message>
/sayHello
</xml>

#set($root = $input.path('$'))
<xml>
<message>
$root.message
</message>
</xml>
<demo>
...
</demo>
Thank you!
@danilop danilop

Вам также может понравиться