Last active
April 3, 2016 02:26
-
-
Save rturk/01a2d43da94bb5290d7a8c7b332a2a79 to your computer and use it in GitHub Desktop.
Simple Publish Message to AWS SNS Topic
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
/** | |
* Sends a Message to AWS topic | |
*/ | |
import AWS from 'aws-sdk'; | |
const message = { | |
test: "Test Message", | |
error: "Error test", | |
}; | |
var sns = new AWS.SNS({params: {TopicArn: 'arn:aws:sns:us-east-1:096957576271:brandlovers-server-error'}}); | |
console.log('sending log message to SNS'); | |
sns.publish({ | |
Message: JSON.stringify(message), | |
MessageStructure: 'json', | |
}, function(err, data) { if (err) { | |
console.log(err.stack); | |
return; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment