add bash to aws-ec2 launch script

This commit is contained in:
Noah Masur
2025-09-26 14:15:04 -04:00
parent f8dfa2a817
commit fbabdadb32

View File

@@ -6,17 +6,17 @@
# 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" | --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 \
--header $'Press Enter to start SSM session\nInstance ID - Private IP - Public IP - Name' \ --header $'Press Enter to start SSM session\nInstance ID - Private IP - Public IP - Name' \
--preview "aws ec2 describe-instances --instance-ids \"\$(echo {} | cut -d' ' -f1)\" | jq -r '.Reservations[].Instances[0]'" \ --preview "aws ec2 describe-instances --instance-ids \"\$(echo {} | cut -d' ' -f1)\" | jq -r '.Reservations[].Instances[0]'" \
--bind "enter:become(aws ssm start-session --target \$(echo {} | cut -d' ' -f1))" --bind "enter:become(aws ssm start-session --document-name 'AWS-StartInteractiveCommand' --parameters '{\"command\": [\"bash\"]}' --target \$(echo {} | cut -d' ' -f1))"