Skip to content

Instantly share code, notes, and snippets.

@pahud
Last active August 17, 2021 18:05
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pahud/811b57f3f2ac694a1ed1115be3b064f5 to your computer and use it in GitHub Desktop.
Save pahud/811b57f3f2ac694a1ed1115be3b064f5 to your computer and use it in GitHub Desktop.
AWS Firehose putRecord with Lambda
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)
});
}
@Zia-
Copy link

Zia- commented Nov 29, 2017

Thanks a ton. Saved my time :-)

@pothuraju1
Copy link

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