Skip to content

Instantly share code, notes, and snippets.

View pbzona's full-sized avatar
😎
on the computer

Phil Z pbzona

😎
on the computer
View GitHub Profile
@pbzona
pbzona / vpn-cloudformation-template.yaml
Created November 14, 2017 23:54
Roll your own VPN with AWS CloudFormation - part three
# Credit to John Creecy
# Original can be found at https://gist.github.com/zugdud/b39eea02faa6926305f57fbde8d31b68
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
@pbzona
pbzona / vpn-cloudformation-template.yaml
Created November 14, 2017 23:43
Roll your own VPN with AWS CloudFormation - Part two
# Credit to John Creecy
# Original can be found at https://gist.github.com/zugdud/f5453af2c827eba38bb036b19e10b371
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
@pbzona
pbzona / vpn-cloudformation-template.yaml
Created November 14, 2017 01:17
Roll your own VPN with AWS CloudFormation - Part One
# Credit to John Creecy
# Original can be found at https://gist.github.com/zugdud/0bf8b2bab65ede19dc42a58d2db721a4
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
@pbzona
pbzona / index.js
Created November 4, 2017 21:15
Implement your first microservice - making your POST request
fetch(lambdaRequest)
.then(response => console.log(response))
.catch(err => console.log(err));
@pbzona
pbzona / index.js
Created November 4, 2017 21:03
Implement your first microservice - create a request object
var lambdaRequest = new Request(endpoint, {
method: 'POST',
mode: 'no-cors',
body: JSON.stringify(body)
});
@pbzona
pbzona / index.js
Created November 4, 2017 20:59
Implement your first microservice - create a body object
var body = {
email: formEmail,
subject: formSubject,
message: formMessage
}
@pbzona
pbzona / index.js
Created November 4, 2017 20:46
Implement your first microservice - define your endpoint
var endpoint = 'https://your-api-gateway-endpoint.com/ContactFormLambda';
@pbzona
pbzona / index.js
Created November 4, 2017 20:42
Implement your first microservice - getting our user values
var formEmail = document.querySelector('.form-email').value;
var formSubject = document.querySelector('.form-subject').value;
var formMessage = document.querySelector('.form-message').value;
@pbzona
pbzona / index.js
Last active November 4, 2017 20:37
Implement your first microservice - event listener
document.getElementById('serverless-contact-form').addEventListener('submit', sendDataToLambda);
@pbzona
pbzona / index.html
Last active November 7, 2017 21:19
<!DOCTYPE html>
<html>
<head>
<title>My Contact Form Microservice</title>
<style>
/* It's not pretty, but it'll do :) */
input,
textarea {
display: block;
margin: 20px;