使用AWS Lambda记录发布数据

时间:2016-06-01 09:33:27

标签: node.js amazon-web-services lambda

我是AWS Lambda的新手。我有一个lambda函数的工作模型,它将json数据记录到cloudwatch和S3存储桶中。

这是功能:

exports.handler = function(event, context) {
    var s3 = new AWS.S3();
    var param = {Bucket: 'test', Key: 'test123', Body: event.name};
    console.log("EVENT DATA :" + param.Body);
    s3.upload(param, function(err, data) {
        if (err) console.log(err, err.stack); // an error occurred
        else console.log(data);           // successful response

        console.log('actually done!');
        context.done();
    });
    console.log('done?');
};

这是我的json数据:

{
  "name": "XYZ ABC",
  "value": 123
}

我应该如何将上面给出的整个JSON数据推送到S3和CloudFront日志而不仅仅是event.name?

感谢。

1 个答案:

答案 0 :(得分:2)

SELECT One.name AS Employee,One.department_id, Two.name AS Chief, Two.department_id FROM employee One, employee Two WHERE (One.chief_id = Two.id AND One.department_id != Two.department_id) OR IFNULL(One.department_id,0)=0; 更改为event.name。如果您在某处获得JSON.stringify(event),请将其更改为[object Object]