私は、Rubyスクリプトを実行するLambda関数を構築する方法を説明するAWS tutorialを続けました。私の唯一の混乱は、ラムダ関数の結果としてRubyスクリプトから結果を返す方法です。Rubyスクリプトを実行するLambda関数の結果を返します
const exec = require('child_process').exec;
exports.handler = function(event, context) {
const child = exec('./lambdaRuby.rb ' + ''' + JSON.stringify(event) + ''', (result) => {
// Resolve with result of process
context.done(result);
});
// Log process stdout and stderr
child.stdout.on('data', console.log);
child.stderr.on('data', console.error);
}
...のように記述すべきですか? – dashmug
LambdaはネイティブでRubyをサポートしていないので、ノード –
に移植されていないRuby gemを使用しています。コールバックであるハンドラ関数に別のパラメータを追加すると思います。http://docs.awsの例を参照してください。 .amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html –