Skip to content

Instantly share code, notes, and snippets.

View geseib's full-sized avatar

George Seib geseib

  • JPMorganChase
  • Atlanta, GA
View GitHub Profile
@geseib
geseib / s3etag2md5hash.py
Last active March 27, 2023 19:30
compare s3 etag to local file hash
from hashlib import md5
import os
import sys
from argparse import ArgumentParser
parser = ArgumentParser(description='Compare an S3 etag to a local file')
parser.add_argument('inputfile', help='The local file')
parser.add_argument('etag', help='The etag from s3')
args = parser.parse_args()
@geseib
geseib / gist:4144ec0f8265cbf69e16c48ccf7a6e80
Created December 18, 2020 20:56
Compare service availability between two AWS regions
#!/bin/bash
#require two regions as parameters
# example: ./rc.sh us-east-2 us-west-1
#
# will outoput the following:
#
# Service count
# -------------
# us-east-2 has 205 services
@geseib
geseib / byoip.sh
Last active June 2, 2019 15:33
create a signed request for BYOIP in AWS
#!/bin/bash
# CIDR should be provided as an argument
#example ./byoip.sh 1.1.1.0/24
if [[ $# -eq 0 ]] ; then
echo '1 argument required: BYOIP CIDR in notation n.n.n.n/nn'
echo 'i.e. ./byoip.sh 1.1.1.0/24'
exit 1
fi
#get account from default user in ~/.aws/credetials
@geseib
geseib / gist:5ecd567e457854064dbdfb68dd2449e1
Created May 9, 2019 12:11
AWS Service Count per Region bash script
#!/bin/bash
declare -a regions=()
#from parameter store get list of regions
regionlist=$(aws ssm get-parameters-by-path --path /aws/service/global-infrastructure/regions/ | jq .Parameters[].Value | cut -d'"' -f 2)
# count number of regions
regioncount=$(echo ${regionlist} | wc -w | tr -d '[:space:]')
# put regions into an array
for region in "${regionlist[@]}"
@geseib
geseib / gist:6b73ea0ee2c5f5eb8726834a6b9e6959
Created May 9, 2019 11:47
AWS EC2 User data for simple webserver with host private IP address
#!/bin/bash
/usr/bin/yum -y install httpd
/sbin/chkconfig httpd on
/sbin/service httpd start
/bin/echo “Welcome to my web server. My private IP is” > /var/www/html/index.html
/opt/aws/bin/ec2-metadata -o | /bin/cut -d: -f2 | /bin/cut -d" " -f2 >> /var/www/html/index.html
<?php
require 'vendor/autoload.php';
use Aws\SecretsManager\SecretsManagerClient;
use Aws\Exception\AwsException;
$client = new SecretsManagerClient([
'region' => 'us-east-1',
'version' => '2017-10-17',
]);