0
0

More than 3 years have passed since last update.

AWS lambda@Edge単体テスト(イベントテンプレート)

Posted at

AWS lambdaを書く時、いちいちデプロイしてテストしてました。

実際どういうリクエストが来るかはある程度イベントテンプレートでまかなえるようです。
lambda@edgeを書いていて、デプロイなどがとても面倒でしたが、これでかなり進みました。

以下の画像はcloudfront-normalize-querystring-to-improve-cache-hitというテンプレートです。

image.png

単純にCloudfrontにGetリクエストが来たような感じですかね

curl https://[CFドメイン]/test?size=LARGE&color=RED

実際に受け取るeventと比較してキー名などは一致してるみたいなので、使えそう.

もしCookieをつけるなら以下のようなものをheadersブロックに追加してあげれば良さそう。

"cookie": [
  {
    "key": "cookie",
    "value": "aaaaa=hogehoge; hoge=200000; status=200"
  }
],
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