Skip to content

Instantly share code, notes, and snippets.

View oli-logicnow's full-sized avatar

Oli Wood oli-logicnow

  • Newcastle Upon Tyne
View GitHub Profile

INCIDENT DATE - INCIDENT TYPE

Meeting

Waiving meetings

In some cases the IC might determine that a PM meeting for the incident isn't needed. If the IC decides to waive the meeting please replace the Meeting section with a note indicating the meeting has been waived (example: Meeting waived: Paul Mooring)

@oli-logicnow
oli-logicnow / AWS ELB pre-warming questions
Created February 15, 2017 07:54 — forked from bridgetkromhout/AWS ELB pre-warming questions
AWS ELB pre-warming questions. These questions (and sample answers) were provided by AWS support on 2013-11-26; I've edited slightly for clarity.
0. What is the name of the ELB which needs to be pre-warmed?
a. e.g. yourwebapp-yourcompany-123456789.us-east-1.elb.amazonaws.com
1. What is the approximate increase percentage in traffic, or expected requests/sec that will go through the load balancer (whichever is easier to answer)?
a. e.g. 3,500 per second
2. Do you know the average amount of data passing through the ELB per request/response pair?
a. e.g. Roughly 250KB.
3. Expected percent of traffic going through the ELB that will be using SSL termination?
@oli-logicnow
oli-logicnow / gist:8dbc82409680438bd798be6d03ba3c3a
Created January 3, 2017 12:06
Let users manage their own creds and force MFA
Replace ACCOUNTID with your 12 character account ID
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
@oli-logicnow
oli-logicnow / gist:f2a51260831b03ebc6cf463c4e44f71e
Created January 2, 2017 08:53
Force an IP address when curling, avoiding messing with /etc/hosts
curl -Iv --resolve example.com:443:52.49.117.44 https://example.com
Super helpful whne doing things like testing services on the end of round-robin IP
@oli-logicnow
oli-logicnow / gist:68008b7f7b352d72755f5fa2aced5760
Created July 19, 2016 10:52
debugging hanging processes (network connection edition)
strace -p {{PROCESS_ID}}
poll([{fd=20, events=POLLIN}], 1, 0) = 0 (Timeout) << see timeout
GRAB FileDescriptor (20)
ls -l /proc/{{PROCESS_ID}}/fd/{{FD}}
lrwx------ 1 root root 64 Jul 18 15:41 /proc/29915/fd/20 -> socket:[2426613614]
GRAB SOCKET (2426613614)
lsof | grep {{SOCKET}}
@oli-logicnow
oli-logicnow / githubencryption.sh
Created June 10, 2016 10:04
A script to make encrypting something using somebodies public github key easier
#!/bin/bash -eux
# githubencryption.sh github_username file_to_encrypt
# NOTE: only works if you've one key in github
export tmpfile=$(mktemp /tmp/key.XXXXXX)
export tmppem=$(mktemp /tmp/pem.XXXXXX)
curl -s -o $tmpfile https://github.com/$1.keys
chmod 600 $tmpfile
ssh-keygen -f $tmpfile -e -m PKCS8 > $tmppem
openssl rsautl -encrypt -pubin -inkey $tmppem -ssl -in $2 -out $2.encrypted
echo "To decrypt: openssl rsautl -decrypt -inkey YOUR_PRIVATE_KEY -in $2.encrypted -out $2"
@oli-logicnow
oli-logicnow / cloudformation.cf
Created May 19, 2016 09:11
UserData scripts for EC with Ansible (via Cloudformation)
"UserData": "{{ launch_script | b64encode}}"
@oli-logicnow
oli-logicnow / gist:4fe9987bbb53a92e9ce0aa4b8e90f3e7
Last active May 16, 2016 08:58
SSH connection being closed when cutting an AMI using ec2_ami for Ansible
I had problems with periodically getting "SSH Error: Shared connection to 52.49.192.253 closed" when cutting an AMI from an instance I'd created.
Because the default action of ec2_ami is to reboot the instance before creating the AMI, Ansible was loosing the connection.
The solution: set no_reboot to "yes" http://docs.ansible.com/ansible/ec2_ami_module.html
- name: Cut AMI
ec2_ami:
region: "{{ aws_region }}"
aws_region: "{{ aws_region }}"
aws_access_key: "{{ aws_access_key }}"
@oli-logicnow
oli-logicnow / gist:ef97b3cd0c5dfc10e37f153cde6f3e30
Created May 5, 2016 08:06
Find the expiry dates of your certs
echo | openssl s_client -connect [SERVER]:443 2>/dev/null | openssl x509 -noout -dates
@oli-logicnow
oli-logicnow / gist:da1be4c9dccadb94670338e21bf4f348
Last active March 15, 2018 15:07
Find all the keys and their associated user for a specific account
export PROFILE=XXXX
for USER in `aws --profile $PROFILE iam list-users --query 'Users[].UserName' --output text`
do
for KEY in `aws --profile $PROFILE iam list-access-keys --user-name "$USER" --query 'AccessKeyMetadata[].AccessKeyId' --output text`
do
echo $USER $KEY
done
done