29 lines
666 B
JavaScript
29 lines
666 B
JavaScript
var AWS = require('aws-sdk');
|
|
var util = require('util');
|
|
var config = require('./config.json');
|
|
|
|
require('dotenv').config({
|
|
'path': `${__dirname }/.env`
|
|
});
|
|
|
|
// configure AWS
|
|
AWS.config.update({ 'accessKeyId': process.env.AWS_ACCESS_KEY_ID, 'secretAccessKey': process.env.AWS_SECRET_ACCESS_KEY, 'region': process.env.AWS_REGION || 'eu-west-1' });
|
|
|
|
var sns = new AWS.SNS();
|
|
|
|
function publish(mesg) {
|
|
var publishParams = {
|
|
'TopicArn' : config.TopicArn,
|
|
'Message': mesg
|
|
};
|
|
|
|
sns.publish(publishParams, function(err, data) {
|
|
process.stdout.write('.');
|
|
// console.log(data);
|
|
});
|
|
}
|
|
|
|
for (var i = 0; i < 500; i++)
|
|
publish(`message: ${ i}`);
|
|
|