0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

API Gateway + Lambdaを構築してみる

Posted at

はじめに

実際に手を動かさないとなかなか理解できないので、今回はAPI Gateway + LambdaでAPI開発をしてみます。
作るものはLambda関数とAPI GatewayでAPIを作成します。

Lambda関数の作成

  • 関数名:hello_lambda
  • ランタイム:Python3.13
    • ※ランタイムはプログラムの「実行時」という意味
      image.png

作成完了

image.png

API Gateway

APIの作成

  • 統合:Lambda
  • AWSリージョン:us-east-1
  • Lambda関数:先ほど作成したLambda関数
  • バージョン:2.0
  • API名:任意のもの
    image.png

ルートの設定

メソッド:ANY
リソースパス:任意のパス名
統合ターゲット:任意のもの
image.png

ステージの定義

image.png

確認

image.png

作成完了

image.png

Lambdaの画面から確認

作成したLambdaに移動して、API Gatewayをクリック
設定タブを選択し、トリガーのAPIエンドポイントでcurlコマンドを叩き、Lambda関数のコード通りのレスポンスが返ってくればOK
image.png

image.png

REST APIでの挑戦

先ほどはHTTPでAPIを作成したので今度はRESTAPIで作成

image.png
image.png

リソースの作成

image.png

メソッドの作成

image.png

デプロイ

image.png

image.png

Lambdaに移動して、確認

image.png

※参考:https://qiita.com/tamura_CD/items/46ba8a2f3bfd5484843f
https://qiita.com/moufuyu/items/340048eef98d98f11187
構成図:https://aws.taf-jp.com/blog/61489

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?