Amazon API Gateway helps developers create and manage APIs to connect backend systems like EC2 and Lambda to mobile, web, and server applications. An API in API Gateway consists of resources and methods. Resources represent logical entities that can be accessed via HTTP verbs like GET and POST. Methods map API requests to integrations with backend systems. API Gateway handles request/response mapping and provides benefits like monitoring, security controls, and scalability without servers. Pricing is based on monthly API calls and data transfer. Caching can reduce costs for frequently requested data.
CONTENT • WHAT ISAPI GATEWAY? • BENEFITS • RESOURCES AND METHODS • CREATE NEW API • CREATE RESOURCE • CREATE METHOD • DEPLOY API • PRICING « US WEST (OREGON) »
3.
WHAT IS APIGATEWAY? • Amazon API Gateway helps developers to create and manage APIs to back-end systems running on Amazon EC2, AWS Lambda or any pubicly addressable web service. • With Amazon API Gateway, you can generate custom client SDKs for your APIs, to connect your back-end systems to mobile, web and server applications or services. • The API you create in API Gateway consists of a set of resources and methods.
4.
BENEFITS • Low-cost andefficient • Performance at any scale • Easily monitor API Activity • Streamline API Development • Flexible Security Controls • Create RESTful Endpoints for Existing Services • Run Your APIs Without Servers
5.
RESOURCES AND METHODS •A resource is a logical entity that can be accessed through a resource path using the API. • A resource can have one or more operations that are defined by appropriate HTTP verbs such as GET, POST, and DELETE. • A combination of a resource path and an operation identify a method in the API. • Each method corresponds to a REST API request submitted by the user of your API and the corresponding response returned to the user. • API Gateway integrates the method with a targeted back end by mapping the method request to an integration request acceptable by the back end and then mapping the integration response from the back end to the method response returned to the user. • As an API developer, you can configure how methods are mapped to integrations and vice versa by stipulating what parameters to use and specifying mapping templates to transform payloads of given data models.
CON’T • Methods canbe GET, DELETE, UPDATE, POST etc. • Select an integration type. We will choose Lambda Function. • Select a lambda region. (us-west-2 etc.) • Enter an existing lambda function from auto- complete textbox.
CON’T • Click IntegrationRequest. Click Body Mapping Templates. Add mapping templates. GET method can have a parameters like a query string. Besides POST requests send data from body part likewise. • GET POST
12.
DEPLOY API • ClickAction and select Deploy API. Click [New Stage]. Deploy new stage.
PRICING « USWEST (OREGON) » • API Calls – $3.50 per million API calls received, plus the cost of data transfer out, in gigabytes. • Data Transfer Costs – $0.09/GB for the first 10 TB – $0.085/GB for the next 40 TB – $0.07/GB for the next 100 TB – $0.05/GB for the next 350 TB
CON’T • Pricing Example: –An API that receives five million API calls per month, with each API call returning responses of 3 kilobytes (KB) in size with no caching. – Example below reflects pricing for US East, US West, EU (Ireland) Amazon API Gateway API call charges 5 million * $3.50/million = $17.50 Total size of data transfers 3 KB * 5 million= 15 million/KB = 14.3 GB Amazon API Gateway data transfer charges 14.3 GB * $0.09 = $1.29 Total Amazon API Gateway charges $17.50 + $1.29 = $18.79
17.
CON’T • Pricing Examplewith Caching Required (US East, US West, EU (Ireland)) – If your API needs 1.5 GB of cache for its data, you can provision a 1.6 GB cache at $0.038/hr. – $0.038 * 24 = $0.912/day