Instantly share code, notes, and snippets.

View OpenVPNWalkthrough-Part3.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
Description: OpenVPN UDP port
ClientIPCIDR:
View OpenVPNWalkthrough-Part2.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
Description: OpenVPN UDP port
SSHKeyName:
View OpenVPNWalkthrough-Part1.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
Description: OpenVPN UDP port
SSHKeyName:
View simpleVPC
AWSTemplateFormatVersion: '2010-09-09'
Description: Simple VPC
Parameters:
VPCName:
Type: String
Default: My VPC
Description: Name for the VPC
Resources:
View accessPolicyListCharactersDynamoDbCharacterData
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "accessPolicyListCharactersDynamoDbCharacterData",
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:GetRecords",
"dynamodb:Query"
View serverlessExample-lambda-listCharacters-testEvent
{
"body": "{\"testamundo\":\"body\"}",
"resource": "/{proxy+}",
"requestContext": {
"resourceId": "123456",
"apiId": "1234567890",
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"accountId": "123456789012",
View serverlessExample-dynamoDB-table-characterData
Resources:
DBLookupTable:
Type: "AWS::DynamoDB::Table"
Properties:
AttributeDefinitions:
-
AttributeName: "gameId"
AttributeType: "S"
-
AttributeName: "characterName"
View serverlessExample-lambda-listCharacters.js
'use strict';
const AWS = require('aws-sdk');
const dynamoClient = new AWS.DynamoDB.DocumentClient({
region: 'us-east-1'
});
function buildResponse(dynamoData) {
console.log("dynamoData: " + JSON.stringify(dynamoData));
return dynamoData;
}
View serverlessExample-dynamoDB-data.json
{
"characters": [{
"gameId": "1",
"characterClass": "rogue",
"characterName": "tarnug",
"intelligence": 12,
"level": 50,
"strength": 16,
"dexterity": 16,
"constitution": 12
View simpleSESIncomingEmailHandler.js
// Handle incoming SES email events, persist the message in S3 and forward to specified address
var AWS = require('aws-sdk');
var ses = new AWS.SES();
var s3Bucket = 'your-bucket-name-to-persist-email-data';
var yourEmail = 'yourname@gmail.com'; // your existing email account to forward emails to
exports.handler = (event, context, callback) => {
console.log(JSON.stringify(event));