Skip to content

Instantly share code, notes, and snippets.

View SkaTeMasTer's full-sized avatar

$hawn Reimerdes SkaTeMasTer

View GitHub Profile
@SkaTeMasTer
SkaTeMasTer / awscli-cmd describe-regions
Created October 1, 2016 03:22
Show regions available for ec2
# show regions available
aws ec2 describe-regions --output text --query 'Regions[*].RegionName'
output:
ap-south-1 eu-west-1 ap-southeast-1 ap-southeast-2 eu-central-1 ap-northeast-2 ap-northeast-1 us-east-1 sa-east-1 us-west-1 us-west-2
@SkaTeMasTer
SkaTeMasTer / free space tip ubuntu
Created October 1, 2016 03:25
How to free up disk space on your Ubuntu web server
# clean-up downloaded apps archives
sudo rm /var/cache/apt/archives/*
@SkaTeMasTer
SkaTeMasTer / disk usage recursive
Created October 1, 2016 03:27
Commands to see where you space is being used.
# disk usage recursive
sudo du / -h --si --max-depth=3 | grep '[0-9]G\>'
@SkaTeMasTer
SkaTeMasTer / awscli
Created October 1, 2016 03:30
List security groups for ec2 instances
# list security groups for ec2 instances
aws ec2 describe-security-groups --query "SecurityGroups[].GroupId | [0]" --output text
output:
si-22642348 sg-11662348
@SkaTeMasTer
SkaTeMasTer / awscli
Created October 1, 2016 03:30
List security groups for ec2 instances
# list security groups for ec2 instances
aws ec2 describe-security-groups --query "SecurityGroups[].GroupId | [0]" --output text
output:
si-22642348 sg-11662348
@SkaTeMasTer
SkaTeMasTer / awscli create IAM user
Created October 1, 2016 04:08
Create a user user IAM
# 1. Creates an IAM user account in AWS
# 2. Randomly generates a password for the account using apg
# 3. Adds the user to the Administrators group
# 4. Creates a login profile for the user (set password and set flag to force user to reset password upon initial logon)
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <username>"
exit 1
@SkaTeMasTer
SkaTeMasTer / awscli IAM role injector
Created October 1, 2016 04:14
force sts command to use json output format. others formats will cause
roleArn="arn:aws:iam::"
roleArn+="$destinationAccountNumber"
roleArn+=":role/"
roleArn+="$rolename"
serialArn="arn:aws:iam::"
serialArn+="$sourceAccountNumber"
serialArn+=":mfa/"
serialArn+="$username"
@SkaTeMasTer
SkaTeMasTer / awscli route53
Created October 1, 2016 05:40
change route53 entry for domain
#!/bin/bash
local CONF="$LE_WORKING_DIR/dnsapi/dns-route53-python.conf"
[ -r "$CONF" ] && . $CONF
if [ -z "$AWS" ]; then
AWS=`which aws 2>/dev/null`
fi
#Usage: add _acme-challenge.www.domain.com "XKrx...."
@SkaTeMasTer
SkaTeMasTer / basic-bind.sh
Created October 5, 2016 20:14
DNS Server -- Simple script to generate a basic bind configuration for home/lab use
#!/bin/bash
#
# Simple script to generate a basic bind configuration for home/lab use
#
# Local config - adjust as required
OWNIP=192.168.111.3
NETWORK=192.168.111.0
NETMASK=/24
DNS1=192.168.111.1
@SkaTeMasTer
SkaTeMasTer / named.conf.options
Last active October 10, 2016 07:06
[Raspberry Pi] - DNS SERVER - list of open DNS servers (/etc/bind/named.conf.options)
options {
directory "/var/cache/bind";
forwarders {
208.67.222.222; # OpenDNS (1/2)
151.202.0.85; # Verizon
198.6.1.3; # uu.net
# ======================================
141.155.0.68; # Verizon (NY, USA)