Skip to content

Instantly share code, notes, and snippets.

View robbwagoner's full-sized avatar

Robb Wagoner robbwagoner

View GitHub Profile
@robbwagoner
robbwagoner / amzn-ami-list-linux.sh
Last active August 29, 2015 14:03
List all the paravirtualized 64-bit Amazon-owner AMIs
#!/usr/bin/env bash
set -e
# Reference:
# AWS EC2 Docs: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html
# AWS CLI: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html
#
# Notes:
# As-of 2014-07-08, the latest amzn ami: amzn-ami-pv-2014.03.1.x86_64-ebs
@robbwagoner
robbwagoner / amazon-linux-python27-pip.sh
Last active July 24, 2017 21:28 — forked from jnrbsn/gist:8062545
Install Python 2.7 for Amazon Linux 2014.03 and older. Python 2.7 is the default for Amazon Linux 2014.09 and newer.
# Amazon Linux 2014.03 and older
sudo yum update
sudo yum install python27
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo /usr/bin/python27
sudo easy_install pip
echo "alias python='python27'" >> ~/.bashrc
source ~/.bashrc
# Amazon Linux 2014.09
yum install python27-setuptools
@robbwagoner
robbwagoner / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@robbwagoner
robbwagoner / newrelic-ubuntu-add-server.sh
Last active August 29, 2015 14:07
Add New Relic agent to Ubuntu host interactively
#!/bin/bash
sudo bash -c '
export DEBIAN_FRONTEND=noninteractive
echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list
wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -
apt-get update
apt-get -y install newrelic-sysmond
nrsysmond-config --set license_key=XXXX
/etc/init.d/newrelic-sysmond start
'
#!/usr/bin/env bash
# vim: autoindent tabstop=2 shiftwidth=2 expandtab softtabstop=2 filetype=sh
# --------------------------------------------
# Firewall Knock Operator wrapper script
# --------------------------------------------
# Robb Wagoner <robb.wagoner@gmail.com>
#
# TODO: Use getopt to process arguments
# TODO: Add function to print script usage
#
@robbwagoner
robbwagoner / git-metadata.sh
Last active July 21, 2017 23:53
Git date and SHA from local repo
#!/usr/bin/env bash
#
# Display Git metadata useful for other scripts
#
# ------------------------------------
# Convert UNIX timestamp (seconds since epoch UTC) to YYYY-MM-DDTHH:MM:SSZ
# ------------------------------------
function unix_to_iso() {
declare ts=${1}
#!/bin/bash
# ----------------------------------------
# Print git metadata for the current repo
# ----------------------------------------
# metadata:
# date: ISO8601 timestamp
# sha: SHA short (7-digit)
# sha_full: SHA 40-digit
#
# optionally create a bash variable prefix, which is useful for eval statements
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# or
# AWS_PROFILE
# python:
#!/bin/bash -e
if [ -f /etc/os-release ] ; then
# newer OS
source /etc/os-release
fi
if [[ $ID_LIKE == "debian" ]] ; then
echo "Debian-like Distro: $PRETTY_NAME"
else

Production Blue-Green Deployment Pattern

came up during IRIS call with Zac, Joel, Julian & Robb - This is Robb's write-up on the matter.

  1. Blue-Green deployment: two Production ASGs & ELBs
  • only one is live at any time (Route53 Alias)
  • standby ASG can be deployed-to (rollforward or rollback), warmed-up (scaling, caching ,etc), and verified (smoke tests, etc. aginst standby.us-east-1.iris.tv) BEFORE being made live
  • Route53 API [ChangeResourceRecordSets] are transactional
  • Post-swap, the newly standby ASG can be updated to 0 desired instances (min and max = 0 too).
  • DNS changing is how AWS Elastic Beanstalk works too (SWAP CNAME API call).