0
0

ApiGateway から Lambda にパラメータを渡す

Last updated at Posted at 2024-07-12

概要

今更だが、ApiGatewayからLambdaを呼び出した際に、指定したパラメータのみを渡す設定方法をまとめた。
ただし以下の「Lambda プロキシ統合」の設定はFalseにする前提で進める。
image.png

設定

1.対象のリソースにて、統合リクエストを選んで「編集」を押下
image.png



2.リクエストパススルーを推奨の設定のままにし、マッピングテンプレートを記載する
image.png

"Lambdaに渡すパラメータキー": "$input.params('呼び出し元が渡したパラメータキー')"

上記で、指定したパラメータがLambdaに渡される


注意ポイント

「テンプレートが定義されていない場合」を選び、マッピングテンプレートの「コンテンツタイプ」で指定した「Content-Type」をリクエストheaderで設定しないと、「Unsupported Media Type」と怒られてリクエストがLambdaに到達できないので注意


参考

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