Skip to content

Instantly share code, notes, and snippets.

View AjaxOdessa's full-sized avatar
🇺🇦

Yevgen Lasman AjaxOdessa

🇺🇦
  • Cprime, Inc.
  • Odessa, Ukraine
View GitHub Profile
@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active January 4, 2025 17:42
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@KaaNee
KaaNee / removeProxmoxClusterConfig.sh
Created January 18, 2025 10:30
BashScript to remove cluster-config of a proxmox-node
#!/bin/bash
# works from 6 to 8 -
# stops services, removes cluster-config from this node (regardless it's state) and restarts services again.
# - Also removing stalled clusternodes as this is leaving the cluster the 'hard' way.
systemctl stop pve-cluster corosync
pmxcfs -l
rm -rf /etc/corosync/*
rm /etc/pve/corosync.conf
killall pmxcfs