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 | |
| # Robust user-data / standalone script to install tooling and attach+mount an EBS volume by Name tag on Nitro (NVMe) instances. | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # --- System update and package installation --- | |
| dnf update -y | |
| dnf upgrade -y | |
| dnf upgrade --releasever=latest -y | |
| dnf install -y docker git unzip cronie python3-pip |
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 | |
| # Stale activity checker | |
| # Runs (e.g. via cron every 5 min). Shuts down instance after 30 min of NO file changes under $MONITOR_DIR. | |
| # Improvements: | |
| # - Uses a state file to persist the last observed activity timestamp. | |
| # - Handles empty directories without immediately triggering shutdown. | |
| # - Works off seconds (no integer minute truncation surprises). | |
| # - Prevents race conditions with a lock. | |
| set -euo pipefail |
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
| # Linux | |
| true &>/dev/null </dev/tcp/$HOSTNAMEorIP/$PORT && echo open || echo closed | |
| # Ansible | |
| ansible all -m win_ping -i $IP, --extra-vars "ansible_user=$username ansible_password=$password ansible_port=5986 ansible_connection=winrm ansible_winrm_server_cert_validation=ignore" | |
| # Powershell | |
| $host="<hostname or IP>";$port=<port>;if(Test-NetConnection -ComputerName $host -Port $port -InformationLevel Quiet){Write-Output "open"}else{Write-Output "closed"} |
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
| #This script will install the cloudformation helper work on Ubuntu 18. | |
| #Some values are hard coded. Make sure to update where needed, or add to the parameters section. | |
| #This would probably work on other distros, but I have not tested yet. Try it out. | |
| #Just make sure to change things like apt to yum if trying on another OS. | |
| Parameters: | |
| EnvironmentSize: | |
| Type: String | |
| Default: t3.nano | |
| AllowedValues: | |
| - t3.nano |