Last active
August 17, 2021 18:05
-
-
Save pahud/811b57f3f2ac694a1ed1115be3b064f5 to your computer and use it in GitHub Desktop.
AWS Firehose putRecord with Lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('starting lambda') | |
var AWS = require("aws-sdk"); | |
AWS.config.update({region: 'us-west-2' }); | |
var fh = new AWS.Firehose(); | |
exports.handler = function(event, context){ | |
fh.putRecord( | |
{ | |
DeliveryStreamName:'my-logs', | |
Record: {Data: new Buffer(JSON.stringify({foo:'bar'})) } | |
}, | |
function(err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else console.log(data); // successful response | |
context.done(err, data) | |
}); | |
} |
I tried the same solution in non-lambda application. It's not working.
can you please help how can use this solution in ECS (non-lambda).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a ton. Saved my time :-)