Skip to content

Instantly share code, notes, and snippets.

View klevo's full-sized avatar
🤠

Robert Starsi klevo

🤠
View GitHub Profile
@klevo
klevo / restart-ssm.sh
Created February 15, 2024 15:51
Restart AWS SSM service after network goes down and then up again
#!/bin/bash
host_to_ping="10.20.4.201"
services_to_restart=("amazon-ssm-agent")
# Check network status before starting the loop
if ping -c 1 -W 1 $host_to_ping > /dev/null; then
echo "Network is up. Script is running in monitoring mode."
else
echo "Network is down. Restarting services..."
@klevo
klevo / lego-get-ssl-cert.sh
Created February 13, 2024 13:26
Obtaining SSL certificates using Lego, Google CA and AWS Route53
# First get the keys for External Account Binding
gcloud publicca external-account-keys create
# Obtaining a certificate
AWS_HOSTED_ZONE_ID=Z01255342XLTM363R5MP8 lego \
--server 'https://dv.acme-v02.api.pki.goog/directory' \
-m '[email protected]' \
-d '*.example.com' \
--eab --kid 'xxxxxxx' \
--hmac 'xxxxxxx' \
@klevo
klevo / sh
Created January 28, 2024 15:15
Install docker-ce on Amazon Linux 2023
dnf install -y \
https://download.docker.com/linux/fedora/38/aarch64/stable/Packages/docker-ce-cli-24.0.5-1.fc38.aarch64.rpm \
https://download.docker.com/linux/fedora/38/aarch64/stable/Packages/containerd.io-1.6.22-3.1.fc38.aarch64.rpm \
https://download.docker.com/linux/fedora/38/aarch64/stable/Packages/docker-ce-24.0.5-1.fc38.aarch64.rpm \
https://download.docker.com/linux/fedora/38/aarch64/stable/Packages/docker-ce-rootless-extras-24.0.5-1.fc38.aarch64.rpm \
https://download.docker.com/linux/fedora/38/aarch64/stable/Packages/docker-buildx-plugin-0.11.2-1.fc38.aarch64.rpm \
https://download.docker.com/linux/fedora/38/aarch64/stable/Packages/docker-compose-plugin-2.20.2-1.fc38.aarch64.rpm \
https://kojipkgs.fedoraproject.org//packages/fuse-overlayfs/1.12/1.fc38/aarch64/fuse-overlayfs-1.12-1.fc38.aarch64.rpm \
https://dl.fedoraproject.org/pub/fedora/linux/releases/38/Everything/aarch64/os/Packages/f/fuse3-libs-3.13.1-2.fc38.aarch64.rpm \
https://kojipkgs.fedoraproject.org//packages/slirp4ne
@klevo
klevo / aws-ami-cleanup.sh
Last active September 5, 2024 12:36
AWS AMI post build cleanup script
#!/bin/bash
function cleanup() {
FILES=("$@")
for FILE in "${FILES[@]}"; do
if [[ -f "$FILE" ]]; then
echo "Deleting $FILE";
sudo shred -zuf $FILE;
fi;
if [[ -f $FILE ]]; then