Skip to content

Instantly share code, notes, and snippets.

View maishsk's full-sized avatar

Maish Saidel-Keesing maishsk

View GitHub Profile
@maishsk
maishsk / gist:9892123
Created March 31, 2014 13:22
instance_name as a parameter
heat_template_version: 2013-05-23
description: Template for setting up a single RHEL 6.4 instance
parameters:
key_name:
description: Name of an existing keypair to enable SSH access to the instances
type: string
default: maish-test
flavor:
description: Flavor of node servers
@maishsk
maishsk / dockerfile
Created November 26, 2014 13:46
Dockerfile
# Git docker container for working with Gerrit for OpenStack
# VERSION 0.0.1
FROM ubuntu:14.04
MAINTAINER Maish Saidel-Keesing "maishsk@gmail.com"
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
ENV git_username "Maish Saidel-Keesing"
ENV git_email "email_address@email.com"
ssh_known_hosts:
- present
- user: root
- fingerprint: 9f:xx:9e:70:d3:85:82:8f:72:9e:be:74:71:d8:1a:74
- fingerprint: bf:88:d4:37:23:e8:98:1a:a3:98:c9:b3:xx:d0:f5:31
- fingerprint: 04:4a:0c:1f:5c:xx:58:b1:00:4f:6d:00:8d:7c:cd:ef
- fingerprint: 2f:9b:5d:4a:xx:a8:28:00:c3:14:e0:3d:8d:18:4a:a1
- fingerprint: e3:26:2c:xx:e0:d6:59:0e:0a:f7:99:4e:71:85:f7:21
- fingerprint: 40:30:6a:xx:b4:99:59:54:74:2e:fd:89:bc:8e:62:90
Hostname,IP
host49,192.168.100.1
ESX2,192.168.100.2
ESX3,192.168.100.3
ESX4,192.168.100.4
ESX5,192.168.100.5
ESX6,192.168.100.6
ESX7,192.168.100.7
ESX8,192.168.100.8
ESX9,192.168.100.9
@maishsk
maishsk / gist:6e76cb939556b7b533014d9090d1bcc0
Created September 3, 2017 19:16
EC2 instance deployment
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template EC2InstanceWithSecurityGroupSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
@maishsk
maishsk / get_az_data.sh
Created January 10, 2018 14:56
Simple way to export all the az's in each region to a file
#!/bin/bash
## Script will get all AZ info from AWS through awscli
## Required: awscli and jq
AZINFO=$(for i in $(aws ec2 describe-regions | jq .Regions[].RegionName | tr -d '"')
do
aws ec2 describe-availability-zones --region $i | jq .AvailabilityZones[].ZoneName | tr -d '"'
done | sort)
@maishsk
maishsk / gist:4ffb281d386eaf6736978992fde54032
Created June 6, 2018 14:39
Encrypt-decrypt KMS and SSM
blob=`aws kms encrypt --key-id $keyid --plaintext "hello_world" --profile work --query CiphertextBlob --output text`
ssmblob=`aws ssm get-parameter --name "encrypted_password" --profile work --with-decryption | jq .Parameter.Value | tr -d '"'`
aws kms decrypt --ciphertext-blob fileb://<(echo $ssmblob | base64 -d) --output text --query Plaintext --profile work | base64 -d
@maishsk
maishsk / create-vpc
Last active June 21, 2018 07:42
Create VPC with AWS CLI
aws ec2 create-vpc --cidr-block 192.168.90.0/24
@maishsk
maishsk / vpc_cloudformation_template.yml
Created June 21, 2018 07:48
Create VPC - with cloudformation
Description:
This template deploys a VPC.
Parameters:
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
Default: "testvpc"
VpcCIDR:
@maishsk
maishsk / create-vpc.yml
Created June 21, 2018 07:58
Create a VPC with Ansible
- name: VPC creation playbook
hosts: localhost
connection: local
gather_facts: no
vars_files:
- vars/vpc_vars.yml
tasks:
- name: Create a VPC