関連記事で実装しているサーバレスWebアプリのサンプルのアクセスログ確認をAthenaでお手軽にしたいと思いました。そこでCloudFront/WAF/API Gatewayのアクセスログをデータレイクとして用意したS3バケットへ保存するようにしてみました。 今回のコード アクセスログ保存の設定概要 CloudFront ログ保存用のS3バケット CloudFrontのログ出力先 WAF ログ保存用のS3バケット Kinesis Firehose WAFのログ出力先 API Gateway API GatewayのCloudWatch Logsへのアクセスログ保存 ログ保存用のS3バケット ログフォーマット変換Lambda Kinesis Firehose CloudWatch Logsのサブスクリプションフィルタ Athenaで確認 CloudFront WAF API Gateway