A script to create, move to OU, and optionally close an AWS Organizations account in one flow.
- AWS CLI installed and configured with a default profile that has Organizations admin permissions
| ## | |
| ## some useful RDS CLI | |
| ## | |
| # RDS events | |
| # Returns events related to DB instances, DB clusters, DB parameter groups, DB security groups, | |
| # DB snapshots, DB cluster snapshots, and RDS Proxies for the past 14 days | |
| # | |
| # can get events up to 2 weeks: | |
| # --duration - default is 60 ; max 14 days via --duration 20160 |
| #!/bin/bash | |
| # | |
| # Create AWS Security Group ZFS security group named "zfs-sg" | |
| # | |
| # sets ports as per https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/limit-access-security-groups.html | |
| # | |
| # Variables - set your VPC_ID | |
| # |
| #!/bin/bash | |
| # | |
| # Create AWS Security Group for FSx named "fsx-sg" | |
| # sets ports as per https://docs.aws.amazon.com/fsx/latest/WindowsGuide/limit-access-security-groups.html | |
| # | |
| # Variables - set your VPC_ID | |
| # | |
| VPC_ID="" |
| # | |
| # This only collecting the non read-only actions. This will save a lot of time and space. | |
| # If you want all events simple remove the --lookup-attributes and the arg. | |
| # | |
| # To generate the time string use somethng like: | |
| # date -d "2 days ago" +"%Y-%m-%d, %H:%M" | |
| # If you don't limit the time range the command will likely timeout. | |
| # | |
| # Can also add --end-time |
| CMD="eks list-clusters" | |
| CMD="ec2 describe-volumes" | |
| for item in $(aws ec2 describe-regions --output text | awk {'print $4'}) | |
| do | |
| echo $item && aws --region $item $CMD | |
| done |
| #!/bin/bash | |
| # This script cleans up your EC2 instance before baking a new AMI. | |
| # this works on Ubuntu (18+) | |
| # Run the following command in a root shell: | |
| # | |
| # bash <(curl -s https://gist.githubusercontent.com/AstroTom/fb0f54d125d38574eae76f57c188c4f0/raw/ami-clean.sh) | |
| function print_green { | |
| echo -e "\e[32m${1}\e[0m" |
| # | |
| # send to q a few treks at a time, then wait till Q is empty to send again | |
| # | |
| AWSACCNT=123456789012 | |
| Q=https://sqs.eu-west-1.amazonaws.com/$AWSACCNT/prd_navigation_q | |
| Q=https://sqs.eu-west-1.amazonaws.com/$AWSACCNT/stg_navigation_q | |
| QMAX=29 # do not fill Q with more than these |
| #!/bin/bash | |
| # Tom R. | |
| # based on https://gist.github.com/dukejones/36128decdb1e003ac5d77f5c4523f1f5 | |
| # Changed to use ~/.aws/config instead | |
| # | |
| set -e | |
| usage () { |
| # | |
| # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| # You must use 'source' to run this file, otherwise it has no effect | |
| # Alternately, you can put it in .bashrc | |
| # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| # e.g. | |
| # $ source credentials.sh | |
| # | |
| # |