0
Ich bin neu bei AWS Lambda. Ich habe ein funktionierendes Modell der Lambda-Funktion, das die JSON-Daten zu Cloudwatch und S3-Bucket protokolliert.Log-Post-Daten mit AWS Lambda
Dies ist die Funktion:
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?');
};
Das ist mein json Daten:
{
"name": "XYZ ABC",
"value": 123
}
Wie soll ich die ganze JSON-Daten gegeben oben auf S3 und Cloudfront meldet sich nicht nur schieben event.name ?
Danke.
Ich habe das früher versucht. Es funktioniert nicht. EREIGNISDATEN: [object Object] wird geloggt und ich erhalte eine Ausnahme, während ich die Daten auf S3 hochlade. Ausnahme ist [Fehler: Nicht unterstütztes Body-Payload-Objekt] 'Fehler: Nicht unterstütztes Body-Payload-Objekt \ n bei ManagedUpload.self.fillQueue – Asish
Vielen Dank. Das funktioniert. – Asish