fix: fallback for ec2 script and only show running instances

This commit is contained in:
Noah Masur 2024-06-05 17:58:22 -04:00
parent 96d410e1b2
commit 99581ae1ea
No known key found for this signature in database

View File

@ -5,14 +5,15 @@
# Specify AWS_PROFILE and AWS_REGION before running this script # Specify AWS_PROFILE and AWS_REGION before running this script
aws ec2 describe-instances | aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" |
jq -r \ jq -r \
'.Reservations[] '.Reservations[]
| .Instances[] | .Instances[]
| .InstanceId + " - " + | .InstanceId + " - " +
(.PrivateIpAddress // "n/a") + " - " + (.PrivateIpAddress // "n/a") + " - " +
(.PublicIpAddress // "n/a") + " - " + (.PublicIpAddress // "n/a") + " - " +
(.Tags | from_entries | .Name // "n/a")' | (.Tags // [] | from_entries | .Name // "n/a")' |
fzf \ fzf \
--height 100% \ --height 100% \
--layout reverse \ --layout reverse \