Skip to content

Instantly share code, notes, and snippets.

@devops100net
devops100net / install_terraform.py
Created December 26, 2023 18:24
Python script to install or update terraform binary on a Linux server
# Python
# AI-generated code. Review and use carefully
import os
import json
import requests
import subprocess
from datetime import datetime
# Define the log file with a timestamp
@devops100net
devops100net / install_terraform.sh
Created December 26, 2023 17:44
Bash script to install or update terraform binary on a Linux server
#!/bin/bash
# Define the log file with a timestamp
logfile="/tmp/install_terraform-$(date +%Y%m%d%H%M%S).log"
# Check if jq is installed
if ! command -v jq &> /dev/null
then
echo "jq could not be found" | tee -a $logfile
echo "Installing jq..." | tee -a $logfile
@devops100net
devops100net / boto3-prompt-all-ec2.py
Created October 21, 2023 11:06
Boto3 Python Code that will list an overview of all known EC2 instances
import boto3
from botocore.config import Config
def list_instances_in_all_regions(check_state=None):
def available_regions(service):
regions = []
client = boto3.client(service)
response = client.describe_regions()
for item in response["Regions"]: