October 15, 2018
API Gateway is a managed service provided by AWS that makes creating, deploying and maintaining APIs easy. The lab creates a Lambda function and triggers it by accessing API Gateway endpoint url. The lab also introduced the best practices of building a RESTful API and the use of micro-service.
Resource: Represented as a URL endpoint and path. For example, api.mysite.com/questions. You can associate HTTP methods with resources and define different backend targets for each method. In a microservices architecture, a resource would represent a single microservice within your system.
Method: In API Gateway, a method is identified by the combination of a resource path and an HTTP verb, such as GET, POST, and DELETE.
Method Request: The method request settings in API gateway store the methods authorization settings and define the URL Query String parameters and HTTP Request Headers that are received from the client.
Integration Request: The integration request settings define the backend target used with the method. It is also where you can define mapping templates, to transform the incoming request to match what the backend target is expecting.
Integration Response: The integration response settings is where the mappings are defined between the response from the backend target and the method response in API Gateway. You can also transform the data that is returned from your backend target to fit what your end users and applications are expecting.
Method Response: The method response settings define the method response types, their headers and content types.
Model: In API Gateway, a model defines the format, also known as the schema or shape, of some data. You create and use models to make it easier to create mapping templates. Because API Gateway is designed to work primarily with JavaScript Object Notation (JSON)-formatted data, API Gateway uses JSON Schema to define the expected schema of the data.
Stage: In API Gateway, a stage defines the path through which an API deployment is accessible. This is commonly used to deviate between versions, as well as development vs production endpoints, etc.
Blueprint: A Lambda blueprint is an example lambda function that can be used as a base to build out new Lambda functions.
Same as the last Lambda tutorial, use Author from Scratch, and configure:
Create function and replace the event handling script, which performs:
Add an API Gateway Trigger, the Lambda function is triggered whenever a call is made to API Gateway:
Create a test by configuring:
Written by Warren who studies distributed systems at George Washington University. You might wanna follow him on Github