Waf Charm

Blog

AWS for beginners

API Gateway for beginners

【Table of contents】

  1. 1. What is an API Gateway?
  2. 2. What is Amazon API Gateway?
  3. 3. Conclusion
  • 1. What is an API Gateway?

    An API gateway is a mechanism that facilitates the management and execution of API.

    An API allows you to share functions with software developed by a third party by releasing a part of the software or application to the outside world.

    The API gateway routes request received from clients to the respective microservices.

    In a typical microservices architecture, the client and each API communicate with each other separately.

    For example, if a single web service uses multiple APIs such as "payment service", "shopping cart", "mail function" and "recommendation function" the client will communicate with each API separately, and in this example, a total of four communications will occur.

    With the API Gateway, the client communicates with the API Gateway and the API Gateway communicates with each microservice, so the client does not need to know the microservice.

  • 2. What is Amazon API Gateway?

    One of the services that provides an API gateway introduced in 1 is the "Amazon API Gateway". Here is an easy-to-understand introduction to this "Amazon API Gateway".

    • a) Overview

      Amazon API Gateway is a part of Amazon's AWS (Amazon Web Services), a cloud service that allows you to use a variety of IT resources over the Internet.

      Amazon API Gateway is a fully managed service that makes it easy to create, distribute, maintain, monitor, and protect APIs for systems of any size.

      It handles all the tasks involved in accepting and processing API calls, including traffic management, authorization and access control, monitoring, and API version control.

      A managed service is a type of service that provides not only cloud computing functions but also operational management as an integrated service. By using managed services, users are relieved of the various tasks related to server operation, such as server construction and failure response.

      To use the Amazon API Gateway, you can use the API Gateway console. You can perform various operations such as displaying a list of APIs and deleting APIs that are no longer used.

    • b) Features of the Amazon API Gateway

      Let's take a quick look at some of the features available in the Amazon API Gateway.

      (i) API Management
      The Amazon API Gateway provides the following features
      ・ Infrastructure management and operation
      ・ Version control
      ・ Certification
      ・ Monitoring of API response status

      Since it is a fully managed service, users do not need to use any of the above services, they just need to use what AWS has provided.

      (ii) Creating the API
      The Amazon API Gateway allows you to create APIs. For example, you can create an API by defining a function in AWS Lambda, which is a function that allows you to run programs on AWS, entering an API name in the API Gateway, and clicking the Create API button.

      You can also use the clone feature to copy an existing API.

    • c) Benefits of the Amazon API Gateway

      What are the benefits of using the Amazon API Gateway? Here are a few in a nutshell.

      (i) Efficient API development
      The Amazon API Gateway makes it easy to manage the version of the API.
      Multiple versions of the same API can be run simultaneously with the API Gateway to iterate, test, and release new versions.

      (ii) Simple monitoring
      AWS allows you to visually monitor calls to services. (You'll need to use a service called Amazon CloudWatch in combination.)
      The items that can be monitored are as follows:
      ・ API call
      The execution of an API. Monitoring allows you to process raw data.
      ・ Data latency
      Latency is the time delay in communication between the time a transfer request is made and the time the data is actually sent. Monitoring illustrates the issues that affect the API.
      ・ Performance metrics for error rates
      Metrics are metrics that allow quantified data to be used for management. The API Gateway sends the number of client-side and server-side errors to CloudWatch as a metric, and CloudWatch displays the metrics it receives.

      (iii) Performance at scale
      When used in conjunction with Amazon CloudFront, API requests to end users and latency can be minimized. It prevents performance degradation by suppressing traffic and ensuring that back-end systems are not called unnecessarily.

      ※Traffic: The amount of data transferred over a network over a computer communication line, such as the Internet or a LAN, within a certain period of time.

      (iv) Massive cost savings
      The AWS API Gateway costs only for the amount of API used. There is no minimum or initial fee. For example, with the REST API, you will only be charged for the amount of API calls received and the amount of data sent.
      AWS API Gateway also has a free tier, which allows you to use 1 million messages per month and 750,000 minutes of connection time for up to 12 months.

      ※REST API: One of the rules for calling a program to use a web system from the outside. REST is a Web design concept that the same result should be obtained from the same URL.

  • 3. Conclusion

    So far, we've discussed the API Gateway and the AWS API Gateway. API gateways require some knowledge and research on API, REST communication, and performance, but if you use them, you can greatly improve the performance of your web system. In addition, with cloud services, the burden is probably much lighter than preparing from scratch because the service provides a certain amount of structure.