Skip to content

Instantly share code, notes, and snippets.

View bashtoni's full-sized avatar

Sam Bashton bashtoni

View GitHub Profile
@bashtoni
bashtoni / compare-db-parameters.sh
Created November 10, 2023 00:56
Compare Aurora database cluster parameters and show differences
#!/bin/bash
# Compare parameters from two different parameter groups, which can be in different regions or accounts
PROFILE1=$1
PG1=$2
PROFILE2=$3
PG2=$4
aws --profile $PROFILE1 rds describe-db-cluster-parameters --db-cluster-parameter-group-name $PG1 --query 'Parameters[].{ParameterName:ParameterName,ParameterValue:ParameterValue}' --output text | sort >> $$-pg1.txt
@bashtoni
bashtoni / changed.sh
Created October 12, 2023 23:08
Show all settings in an RDS parameter group which have been changed from the default
aws rds describe-db-cluster-parameters \
--db-cluster-parameter-group-name $PARAMETER_GROUP_NAME \
--query 'Parameters[].{ParameterName:ParameterName,DataType:DataType,Source:Source,Description:Description,ParameterValue:ParameterValue} | [?Source == `user`]'
@bashtoni
bashtoni / gist:ca532e90027bce842e56f85d66d0c4fc
Created June 20, 2023 05:00
curl to an alternate host - check before changing DNS
curl -IX GET --connect-to oldhost:443:newhost:443 https://oldhost
@bashtoni
bashtoni / gist:955658356e8b9278debbce356d2321d3
Created June 1, 2023 09:07
Cognito password reset from CLI
aws cognito-idp admin-create-user --user-pool-id eu-west-3_POOLID --username example@gmail.com --message-action RESEND
@bashtoni
bashtoni / ebs-k8s-resize.md
Created May 15, 2023 00:36
Resizing EBS volumes in a Kubernetes cluster

Resizing EBS volumes in a Kubernetes cluster

  • Edit the gp2 storage class to add allowVolumeExpansion: true
  • Edit the persistent volume claim with the new amount of required storage
  • Re-create the pod using the persistent volume claim
  • The pv and pvc should now reflect the new amount of storage
TZ=":Etc/UTC" aws s3 ls s3://BUCKET/
@bashtoni
bashtoni / pfsense-on-centos-8.md
Last active June 25, 2022 21:14 — forked from RulerOf/pfsense-on-centos-8.md
Installing pfSense on KVM in CentOS 8

Installing pfSense on KVM in CentOS 8

We download the latest release of pfSense as a gzipped ISO, then extract it and pass it to virt-install to get the VM up and running. Interactive portions of setup are done with virt-install's native console redirection.

Instructions

Install and start libvirtd

sudo dnf -y install libvirt-daemon
sudo systemctl enable --now libvirtd
@bashtoni
bashtoni / i.sh
Created April 13, 2022 23:55
Install AWS CLI in homedir
./install -b ${HOME}/.local/bin/ -i ${HOME}/awscli
@bashtoni
bashtoni / global_quota_increase.sh
Created May 18, 2021 01:31
Request a quota increase across all regions
#!/bin/bash
SERVICE_CODE=cloudformation
QUOTA_CODE=L-0485CB21 # Number of stacks - find via `aws service-quotas list-service-quotas` or AWS Console
DESIRED_VALUE=500
for region in $(aws ec2 describe-regions --query Regions[][RegionName] --output text); do
aws service-quotas --region $region request-service-quota-increase \
--service-code $SERVICE_CODE \
--quota-code $QUOTA_CODE \
@bashtoni
bashtoni / attach-multiple-volumes.sh
Last active June 9, 2020 04:22
Attach multiple volumes to an EC2 Instance
count=0
for vol in vol-0123abcd vol-1023abcd vol-2013abcd ; do
device="/dev/xvd$(echo $count | tr '[0-9]' '[j-z]')"
aws ec2 attach-volume --volume-id $vol --instance-id i-123456789abc --device $device
count=$(expr $count + 1)
done