This file contains 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
const winston = require('winston') | |
const { createLogger, format } = require('winston') | |
const { combine, timestamp, printf } = format | |
const moment = require('moment') | |
require('winston-daily-rotate-file') | |
// SEND LOGS TO A BUCKET | |
/* | |
const S3StreamLogger = require('s3-streamlogger').S3StreamLogger | |
const s3Stream = new S3StreamLogger({ |
This file contains 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
// Please remember there are constants that are not defined in this scripts | |
// You have to set logs dir, bucket credentials and so forth | |
const uploadToS3 = (fileName) => { | |
let s3bucket = new AWS.S3({ | |
accessKeyId: IAM_USER_KEY, | |
secretAccessKey: IAM_USER_SECRET, | |
Bucket: BUCKET_NAME, | |
}); |
This file contains 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
module.exports = (sqs) => { | |
const createQueue = async (queueName) => { | |
return await new Promise((resolve, reject) => { | |
const createQueueParams = { | |
QueueName: queueName, | |
Attributes: { | |
'DelaySeconds': '0', | |
'MessageRetentionPeriod': '86400' | |
} |
This file contains 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
{ | |
"Statement": [ | |
{ | |
"Action": [ | |
"apigateway:*", | |
"cloudformation:CancelUpdateStack", | |
"cloudformation:ContinueUpdateRollback", | |
"cloudformation:CreateChangeSet", | |
"cloudformation:CreateStack", | |
"cloudformation:CreateUploadBucket", |
This file contains 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
const AWS = require('aws-sdk'); | |
const ses = new AWS.SES({ | |
region: 'us-east-1' | |
}); | |
const createTemplate = () => { | |
var params = { | |
Template: { /* required */ |