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 | |
| echo "Now Updating all Docker Containers" | |
| export TZ=UTC # force all timestamps to be in UTC (+00:00 / Z) | |
| printf -v start_date_epoch '%(%s)T' | |
| printf -v start_date_iso8601 '%(%Y-%m-%dT%H:%M:%S+00:00)T' "$start_date_epoch" | |
| # List of all folders that contain a docker compose | |
| declare -a StringArray=("auth-stack" "bitwarden" "languagetool" "media-stack" "monitoring" "" "mosquitto" "portainer" "dnsmasq" "socks5" "nginx-proxy-manager" "filebrowser") | |
| # Iterate the string array using for loop |
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
| aws ec2 describe-images --owners 136693071363 --filters 'Name=root-device-type,Values=ebs' 'Name=architecture,Values=x86_64' 'Name=name,Values=debian-11-amd64-20**' | jq -r '[ .Images[] | {ImageId,CreationDate} ] | sort_by(.CreationDate) | reverse | first | .ImageId' |
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
| vim /usr/bin/cloud-init | |
| less /var/log/cloud-init.log |
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
| curl -s 169.254.169.254/1.0/meta-data/instance-id |
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
| curl -s 169.254.169.254/1.0/meta-data/public-ipv4 |
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
| S3_USERID=$(aws s3api list-buckets --query Owner.ID --output text) |
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
| aws ce get-cost-and-usage --time-period Start=2022-12-01,End=2022-12-31 --granularity MONTHLY --metrics UsageQuantity --group-by Type=DIMENSION,Key=SERVICE | jq '.ResultsByTime[].Groups[] | select(.Metrics.UsageQuantity.Amount > 0) | .Keys[0]' |
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
| terraform show tfplan.out | jq >tfplan.json | |
| jq '.terraform_version, .format_version' tfplan.json |
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 . -d -type d -name '.terraform' -exec rm -r {} \; | |
| find . -d -type f -name '.terraform*' -exec rm -r {} \; | |
| find . -d -type f -name '*tfstate*' -exec rm -r {} \; | |
| find . -d -type f -name 'tfplan.out' -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
| # Verify distro | |
| cat /etc/os-release | |
| # Amazon Linux 2 | |
| sudo amazon-linux-extras install epel -y | |
| # RHEL 8 | |
| sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y | |
| # RHEL 7 |
NewerOlder