Everything you need to know about Amazon API Gateway

API gateway

Amazon API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, authorization and access control, monitoring, and API version management.

Amazon API Gateway

Amazon API Gateway

Amazon API Gateway is an AWS service that enables developers to create, publish, maintain, monitor, and secure APIs at any scale.

Amazon API Gateway

1. Gateway to AWS Cloud and Beyond

API_gateway_cloud_For example, an application can call an API in API Gateway to upload a user’s annual income and expense data to Amazon S3 or Amazon DynamoDB, process the data in AWS Lambda to compute tax owed, and file a tax return via the IRS website. With Amazon API Gateway, you can build an API to provide your users with an integrated and consistent developer experience to build AWS cloud-based applications.

2. Part of AWS Serverless Infrastructure

For an app to call publicly available AWS services, you can use Lambda to interact with the required services and expose the Lambda functions through API methods in API Gateway.

Developer Experiences
The app developer does not need to have an AWS account, provided that the API does not require IAM permissions or supports authorization of users from third-party identity providers supported by Amazon Cognito identity federation.

3. Create and Manage an API Gateway

An API developer works with the API Gateway service component, named apigateway, to create, configure, and deploy an API.

A method corresponds to a REST API request that is submitted by the user of your API and the response returned to the user.

To route the integration response to an appropriate method response (of a given HTTP status code) to the client, you can configure the integration response to map required response parameters from integration to method.

As an API developer, you can create and manage an API by using the API Gateway console, described in Getting Started with Amazon API Gateway, or by calling the API Gateway REST API.

4. Calling an API Gateway API

An app developer works with the API Gateway service component, named execute-api, to invoke an API that was created or deployed in API Gateway.

Benefits of API Gateway

API Gateway is designed for web and mobile developers who want to provide secure, reliable access to backend APIs for access from mobile apps, web apps, and server apps that are built internally or by third-party ecosystem partners.

Amazon API Gateway Concepts

Each API resource can expose one or more API methods that must have unique HTTP verbs supported by API Gateway.

An app creator who may or may not have an AWS account and interacts with the API deployed by the API developer.

API Gateway supports the following types of API endpoints, each entailing different behaviors and designed for a specific set of API client access patterns.

Together with latency-based routing, regional endpoints enable an API developer to deploy an API to multiple regions using the same regional API endpoint configuration, setting the same custom domain name for each deployed API, and configuring latency-based DNS records in Amazon Route 53 to route client requests to a region of the lowest latency.

An API owner can use API keys to permit or deny access of specific APIs based on the apps in use.

An API deployment is a point-in-time snapshot of the API Gateway API resources and methods.

The public interface of an API method in API Gateway that defines the parameters and body that an app developer must send in the requests to access the backend through the API.

An API Gateway internal interface that defines how API Gateway maps the parameters and body of a method request into the formats required by the backend.

An API Gateway internal interface that defines how API Gateway maps data.

The public interface of an API that defines the status codes, headers, and body models that an app developer should expect from API Gateway.

PHP Sample Program

<?php

require_once(‘aws/aws-autoloader.php’);

use Aws\Credentials\Credentials;

use GuzzleHttp\Client;

use GuzzleHttp\Psr7\Request;

use Aws\Signature\SignatureV4;

$access_key = ‘XXXXXXXXXXXXXXXXXXXXX’;

$secret_key = ‘XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’;

$url = ‘https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/testing/xxxxxxx’;

$region = ‘us-east-1’;

$credentials = new Credentials($access_key, $secret_key);

$client = new Client();

$request = new Request(‘POST’, $url, array(), ‘{“email”:”test@gmail.com”,”call_started_at”:”2017-10-26 13:20:28 -0600″,

“name”:”test test”,”phone”:”9894433002″,”filename”:”2017/10/26/9894433002_20171026132028.mp3″,

“school_ids”:[707],”school_names”:[“Test – Campus”],”client_ids”:[],”address”:”56 sugar st”,

“city”:”Phoenix”,”state”:”AZ”,”zip”:”85001″,”agent”:”62″,”campaign”:”PRECALL”,”vendor_lead_id”:”96358″}’);

$s4 = new SignatureV4(“execute-api”, $region);

$signedrequest = $s4->signRequest($request, $credentials);

$response = $client->send($signedrequest);

echo $response->getBody();

?>

If you’re interested in migrating to the cloud, then we’re more than happy to help you get started. Solace is there to help you for cloud platform. We believe in benefits of using AWS. We will provide the means to bring your company the success it deserves. Contact us for web development using AWS.