diff --git a/pkgs/tools/misc/aws-ec2/aws-ec2.sh b/pkgs/tools/misc/aws-ec2/aws-ec2.sh index 1a787ab..f72999a 100755 --- a/pkgs/tools/misc/aws-ec2/aws-ec2.sh +++ b/pkgs/tools/misc/aws-ec2/aws-ec2.sh @@ -6,17 +6,17 @@ # Specify AWS_PROFILE and AWS_REGION before running this script aws ec2 describe-instances \ - --filters "Name=instance-state-name,Values=running" | - jq -r \ - '.Reservations[] + --filters "Name=instance-state-name,Values=running" | + jq -r \ + '.Reservations[] | .Instances[] | .InstanceId + " - " + (.PrivateIpAddress // "n/a") + " - " + (.PublicIpAddress // "n/a") + " - " + (.Tags // [] | from_entries | .Name // "n/a")' | - fzf \ - --height 100% \ - --layout reverse \ - --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]'" \ - --bind "enter:become(aws ssm start-session --target \$(echo {} | cut -d' ' -f1))" + fzf \ + --height 100% \ + --layout reverse \ + --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]'" \ + --bind "enter:become(aws ssm start-session --document-name 'AWS-StartInteractiveCommand' --parameters '{\"command\": [\"bash\"]}' --target \$(echo {} | cut -d' ' -f1))"