Skip to content

Instantly share code, notes, and snippets.

View guikaercher's full-sized avatar
🏠
Working from home

Guilherme Kaercher guikaercher

🏠
Working from home
View GitHub Profile
@guikaercher
guikaercher / aws-ses.js
Last active July 9, 2020 20:36
AWS SES endpoints for TEMPLATES
const AWS = require('aws-sdk');
const ses = new AWS.SES({
region: 'us-east-1'
});
const createTemplate = () => {
var params = {
Template: { /* required */
@guikaercher
guikaercher / IAMCredentials.json
Created February 5, 2019 13:39 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@guikaercher
guikaercher / sqsHelper.js
Created February 4, 2019 13:29
SQS helper for Node.js
module.exports = (sqs) => {
const createQueue = async (queueName) => {
return await new Promise((resolve, reject) => {
const createQueueParams = {
QueueName: queueName,
Attributes: {
'DelaySeconds': '0',
'MessageRetentionPeriod': '86400'
}
@guikaercher
guikaercher / upload file to S3 AWS.js
Last active December 4, 2018 15:35
upload file to S3 AWS
// 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,
});
@guikaercher
guikaercher / customLogger.js
Last active August 9, 2020 13:36
Custom logger with winston snippet
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({