This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| # for examples | |
| # If not running interactively, don't do anything | |
| case $- in | |
| *i*) ;; | |
| *) return;; | |
| esac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # error handling | |
| error_handler() { | |
| echo "Error occurred in script at line: ${1}" | |
| echo "Line exited with status: ${2}" | |
| } | |
| trap 'error_handler ${LINENO} $?' ERR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Set variables for tags, region, SSH key location & user | |
| # Set these 4 to appropriate values | |
| REGION="eu-central-1" | |
| TAG="chris-sandbox" | |
| SSH="~/.ssh/frankfurt.pem" | |
| USER="ubuntu" | |
| # Check AWS credentials exist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" user@host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| region="eu-west-1" | |
| cluster="<CLUSTER_NAME>" | |
| ## Get Task names from Cluster | |
| task_status () { | |
| echo "Task Name and Status:" | |
| mapfile -t tasksInCluster < <(aws ecs list-tasks --region $region --cluster $cluster | jq -r '.taskArns[]') | |
| for task in "${tasksInCluster[@]}"; do | |
| aws ecs describe-tasks --region $region --cluster $cluster --tasks $task | jq -r '.tasks[].containers[] | .name + " " + .lastStatus' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Set variables for tags, region, SSH key location & user | |
| # Set these 4 to appropriate values | |
| REGION="eu-central-1" | |
| TAG="<EC2_TAG>" | |
| SSH="~/.ssh/<PATH_TO_FILE>" | |
| USER="ubuntu" | |
| # Check AWS credentials exist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Enable extended globbing for the +(...) pattern | |
| shopt -s extglob | |
| ## Variable Declartions ## | |
| OUTPUT="text" # set output format | |
| ## FUNCTIONS ## | |
| # apply Instance DB deletion protection |
OlderNewer