- Programming Model (Node.js) - AWS Lambda
AWS Lambda currently supports the following Node.js runtimes:
Node.js runtime v4.3 (runtime = nodejs4.3)
- Lambda Function Handler (Node.js) - AWS Lambda
callback(); // Indicates success but no information returned to the caller.
callback(null); // Indicates success but no information returned to the caller.
callback(null, "success"); // Indicates success with information returned to the caller.
callback(error); // Indicates error with error information returned to the caller.
- 初めてのJavaScript、初めてのAWS Lambda | Developers.IO
以下のようにlambdaスクリプトと外部モジュールディレクトリを指定してzip化します。
$ zip -r myfunc.zip index.js node_modules
- AWS Lambdaのための関数のローカル開発とテスト - Qiita
event: 実際に渡ってくるイベントのデータ(S3のアップデートとかKinesisのレコードとか)。
context: Lambda functionの呼び出しコンテキスト。
- AWS Lambdaの関数をnpmでパッケージ管理 - Qiita
ということで、何をやってきたかをまとめてみると、以下のようなステップを実現してみようぜという話でした。
ローカルで開発
npm testでユニットテストやLintを走らせる
npm buildでパッケージ(Lambda用のzipファイル)のビルド
npm initLambdaでLambda用の設定ファイルを作る
npm publishでLambdaにアップロード