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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject", | |
"s3:DeleteObject" |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Allow Public Access to All Objects", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::<www.mywebsite.com>/*" | |
} |
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
'use strict'; | |
const AWS = require("aws-sdk"); | |
const dynamo = new AWS.DynamoDB.DocumentClient(); | |
exports.handler = (event, context, callback) => { | |
const contactInfo = {}; | |
contactInfo.Item = { | |
"email": event.email, | |
"name": event.name, | |
"message": event.message | |
}; |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "mywebsiteContactUsTableWrite", | |
"Effect": "Allow", | |
"Action": [ | |
"dynamodb:PutItem", | |
"dynamodb:UpdateItem" | |
], |
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
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "mywebsite" | |
}, | |
"paths": { | |
"/contact-us": { | |
"post": { | |
"produces": [ | |
"application/json" |
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
aws rds create-db-parameter-group --db-parameter-group-name replication --db-parameter-group-family MySQL5.7 --description "My DB params for replication" | |
aws rds modify-db-parameter-group --db-parameter-group-name mydbparametergroup --parameters "ParameterName=binlog_format,ParameterValue=ROW,ApplyMethod=immediate" | |
aws rds modify-db-instance --db-instance-identifier myMasterDBInstance --db-parameter-group-name replication | |
# Wait for sometime so that instance finish modification and then reboot the instance. | |
aws rds reboot-db-instance --db-instance-identifier myMasterDBInstance |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Allow Public Access to All Objects", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::<www.mywebsite.com>/*" | |
} |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"logs:CreateExportTask", | |
"logs:DescribeExportTasks", | |
"logs:DescribeLogGroups" |
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
const AWS = require('aws-sdk'); | |
const cloudwatchLogs = new AWS.CloudWatchLogs(); | |
function getDatePath(date) { | |
date = date || new Date(); | |
const dateString = date.toISOString().substring(0, 10); | |
return dateString.replace(/-/g, '/'); | |
} | |
function getLogPathForS3(logGroupName) { |
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
{ | |
"Comment": "Cloudwatch logs to S3 export task", | |
"StartAt": "CreateExportTask", | |
"States": { | |
"CreateExportTask": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:eu-west-1:<awws-account-id>:function:CloudwatchLogsToS3Exporter", | |
"Next": "IsAllLogsExported" | |
}, | |
"IsAllLogsExported": { |
OlderNewer