Skip to content

Instantly share code, notes, and snippets.

View adhorn's full-sized avatar

Adrian Hornsby adhorn

View GitHub Profile
Title:
Incident date:
Owner:
Peer-review committee:
Tags:
Summary:
Supporting data:
Customer Impact:
Incident Response Analysis:
Post-Incident Analysis:
@adhorn
adhorn / stop_random_instance_api.yml
Created June 1, 2020 12:55
Randomly stop EC2 instances using SSM Automation
---
description: Stop instances in a particular AZ with tag filter
schemaVersion: '0.3'
assumeRole: "{{ AutomationAssumeRole }}"
parameters:
AvailabilityZone:
type: String
description: "(Required) The Availability Zone to impact"
TagName:
type: String
@adhorn
adhorn / nginx.conf
Last active January 3, 2024 03:09 — forked from mikhailov/gist:9639593
Nginx S3/Unicorn Proxy with backend keep alive
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@adhorn
adhorn / gist:4659eb98428c83726ad4ff2ea19a27f9
Created April 8, 2020 05:35
IAM role - SSM Run (Send) Command
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:DescribeAssociation",
"ssm:GetDeployablePatchSnapshotForInstance",
"ssm:GetDocument",
"ssm:DescribeDocument",
@adhorn
adhorn / exhaust_ephemeral_ports.py
Created February 21, 2022 14:21 — forked from ZuZuD/exhaust_ephemeral_ports.py
Simulate an ephemeral port exhaustion on a Linux client.
import socket
import time
import argparse
import subprocess
import shlex
"""
Usage: python3 exhaust_ephemeral_ports.py <dst> <dport> <optional:loop>
Example: python3 exhaust_ephemeral_ports.py 172.31.23.144 80
Help: exhaust_ephemeral_ports.py --help
@adhorn
adhorn / env_us-east-1.yml
Created May 3, 2018 12:08
Serverless framework to support deploy Lambda Functions in VPC
STATUS: 200
lambdaExecSecurityGroups: ["sg-xxxxxxx"]
subnets: ["subnet-xxxxxxx"]
@adhorn
adhorn / gist:997496feec26f217011e085a0f9fbc5c
Created April 24, 2018 07:13
Create DynamoDB Global Tables
#create the initial table with stream enabled (here in Ireland)
aws dynamodb create-table \
--table-name MyGlobalTable \
--attribute-definitions \
AttributeName=item_id,AttributeType=S \
--key-schema \
AttributeName=item_id,KeyType=HASH \
--provisioned-throughput \
ReadCapacityUnits=5,WriteCapacityUnits=5 \
--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \
@adhorn
adhorn / gist:11cd47b215547a413e825ce7c506c6ba
Created April 29, 2021 06:09 — forked from jacksonfdam/gist:3000275
Regular Expressions List
//Regular Expressions List
//Short Tutorial
\ // the escape character - used to find an instance of a metacharacter like a period, brackets, etc.
. // match any character except newline
x // match any instance of x
^x // match any character except x
[x] // match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z
| // an OR operator - [x|y] will match an instance of x or y
@adhorn
adhorn / gist:c315cb13331528b09f39a592344ec7cb
Created April 22, 2020 14:05
Chaos Toolkit experiment to stop docker locally
{
"version": "1.0.0",
"title": "What is the impact of an terminating the database master",
"description": "terminating the master database should not prevent the application from running",
"tags": ["db"],
"configuration": {
"endpoint_url": {
"type": "env",
"key": "ELEANOR_URL"
}
@adhorn
adhorn / stop_random_instance_api.py
Created June 9, 2020 14:34
Randomly stopping instance via AWS Lambda
import boto3
import random
import time
def stop_random_instance(ec2_client, az_name, tag):
paginator = ec2_client.get_paginator('describe_instances')
pages = paginator.paginate(
Filters=[
{