Skip to content

Instantly share code, notes, and snippets.

@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active January 29, 2024 10:00
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
@shashishailaj
shashishailaj / gist:091a2cd5146c36604ecac9e70ce6d50a
Created November 5, 2017 09:54
How to Setup USB Disk, NFS Server and Bittorrent on OpenWrt Attitude Adjustment and connect from OSX

Background:

  • I have a TP-Link MR3020 router. I live in Bangalore and am using gBroadband.
  • I frequently travel from home and feel I am not making 100% use of my broadband bandwidth.
  • I also don't like keeping my USB HDD attached to my computer because if I move physically even the USB HDD gets disconnected.

So best option was to have NAS (Network Attached Device), set up NFS (Network File Server) on my router and access my files wirelessly from my computer running OSX Yosemite. Hence the title of this article! After many failed attempts, looking through incomplete documentation, I finaly have the perfect setup. Hope this helps you in some way :)

Jargon/terminology