Closed5

API GatewayのREST APIとHTTP APIの比較

ChiHaRuChiHaRu

API Gatewayの種類

ステートレス

(1) REST API
(2) HTTP API

ステートフル

(3) WebSocket API

の3種類がある
https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/welcome.html

料金については、コチラ
https://aws.amazon.com/jp/api-gateway/pricing/

※うち、ステートレスな (1) REST API , (2) HTTP API の比較は以下の通り
https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/http-api-vs-rest.html

上記3種類のAPIの特徴

(1) REST API

(2) HTTP API

  • REST API よりも低いレイテンシーとコストで RESTful API を作成できる
  • その反面、REST APIと比較し、できることは限定的(ただし、自動デプロイなどHTTP APIのみできることもある)

(3) WebSocket API

  • クライアントとサーバーの両方がいつでも相互にメッセージを送信できる
  • リアルタイム通信に使用

https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/api-gateway-overview-developer-experience.html

ChiHaRuChiHaRu

API Gateway V1 API と API Gateway V2 API

API Gateway V1 API

正確には、Amazon API Gateway Version 1 API(たぶん)
API GatewayのREST APIを操作(※)するためのAPI
https://docs.aws.amazon.com/ja_jp/apigateway/latest/api/API_Operations.html

API Gateway V2 API

正確には、Amazon API Gateway Version 2 API(たぶん)
API GatewayのHTTP APIおよびWebSocket APIを操作(※)するためのAPI
https://docs.aws.amazon.com/ja_jp/apigatewayv2/latest/api-reference/api-reference.html

補足事項

ここでいう※の操作とは、API Gateway上にAPIを作成、削除したり、呼び出したりすること

参考ページ

https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/welcome.html
https://docs.aws.amazon.com/ja_jp/apigateway/

関連事項

CloudFormationやTerraformなども、Vesion1(無印)はREST API操作のためのもの、Version2はHTTP APIおよびWebSocket API操作のためのもの

CloudFormation

https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/AWS_ApiGateway.html
https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/AWS_ApiGatewayV2.html

Terraform

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_rest_api
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api

ChiHaRuChiHaRu

ステージとデプロイ

ステージ

  • APIのライフサイクル状態への論理的な参照(例: dev'、'prod'、'beta'、'v2' など)
  • API ステージは API ID とステージ名によって識別される
  • ステージ変数の使用により、異なるバックエンドのエンドポイントとやりとりするようAPIデプロイステージを設定できる

デプロイ

  • API Gateway API の特定時点のスナップショット
  • クライアントが使用できるようにするには、デプロイが 1 つ以上の API ステージに関連付けられている必要がある

https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/api-gateway-basic-concept.html

このスクラップは3ヶ月前にクローズされました