Skip to content

Instantly share code, notes, and snippets.

View pbzona's full-sized avatar
🤠
having fun on the computer

Phil Z pbzona

🤠
having fun on the computer
View GitHub Profile
@pbzona
pbzona / params.json
Last active November 21, 2017 18:11
CloudFormation - EC2 creation JSON template excerpt
[
{
"ParameterKey": "InstanceType",
"ParameterValue": "t2.small"
}
]
@pbzona
pbzona / CLI
Created November 21, 2017 18:06
CloudFormation - EC2 creation command with parameters
$ aws cloudformation create-stack --stack-name ec2-$(date +%s) --template-body file://ec2-param.yml --parameters "ParameterKey=InstanceType,ParameterValue=t2.small"
@pbzona
pbzona / ec2-param.yml
Created November 21, 2017 18:05
CloudFormation - EC2 creation template with parameters
Parameters:
 InstanceType:
   Description: EC2 instance type
   Type: String
   Default: t2.micro
Resources:
 EC2Instance:
   Type: AWS::EC2::Instance
   Properties:
     InstanceType: !Ref InstanceType
@pbzona
pbzona / CLI
Created November 21, 2017 18:02
CloudFormation - EC2 create confirmation command
$ aws cloudformation describe-stacks --stack-name ec2
{
"Stacks": [
{
"StackId": "arn:aws:cloudformation:us-east-1:160619113767:stack/ec2/fbbfc9f0-c026-11e7-b32e-503aca2616d1",
"Tags": [],
"CreationTime": "2017-11-02T23:38:52.308Z",
"StackName": "ec2",
"NotificationARNs": [],
"StackStatus": "CREATE_COMPLETE",
@pbzona
pbzona / CLI
Created November 21, 2017 17:58
CloudFormation - EC2 creation from CLI
$ aws cloudformation create-stack --stack-name ec2 --template-body file://ec2.yml
{
"StackId": "arn:aws:cloudformation:us-east-1:160619113767:stack/ec2/fbbfc9f0-c026-11e7-b32e-503aca2616d1"
}
@pbzona
pbzona / ec2.yml
Created November 21, 2017 17:55
CloudFormation - EC2 creation template
Resources:
 EC2Instance:
   Type: AWS::EC2::Instance
   Properties:
     InstanceType: t2.micro
     KeyName: 'default' # keypair must already exist
     ImageId: ami-6869aa05 # AMI us-east-1
@pbzona
pbzona / your-react-app.conf
Created November 19, 2017 06:38
Excerpt of nginx conf for React deployment
root /var/www/react/build;
index index.html index.htm;
@pbzona
pbzona / post-receive
Last active November 19, 2017 06:35
Post receive hook for deploying React apps to Linode
#!/bin/bash
TARGET="/var/www/react"
GIT_DIR="/var/www/react.git"
BRANCH="master"
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [[ $ref = refs/heads/$BRANCH ]];
then
@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