Skip to content

Commit

Permalink
🐛 Added grep -v None to exclude terminated instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lubneuski committed Nov 27, 2024
1 parent 93f8f2d commit 96dec5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion d3b_cli_igor/utils/scripts/dev-env-tunnel
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if [ ! -z $(ps -ef | grep "ssm start-session" | grep -v grep | awk '{ print $2 }
fi

echo "getting info"
info=$(aws ec2 describe-instances --region us-east-1 --query "Reservations[*].Instances[?Tags[?Key=='Name']|[?Value=='$ORG-infra-bastion-ssm-ec2-$syslevel-0']].[InstanceId,PrivateIpAddress]" --output text | tail -1)
info=$(aws ec2 describe-instances --region us-east-1 --query "Reservations[*].Instances[?Tags[?Key=='Name']|[?Value=='$ORG-infra-bastion-ssm-ec2-$syslevel-0']].[InstanceId,PrivateIpAddress]" --output text | grep -v None | tail -1)
INSTANCE_ID=$(echo "$info" | awk '{ print $1 }')
INSTANCE_IP=$(echo "$info" | awk '{ print $2 }')
if [ -z "$INSTANCE_ID" ]; then
Expand Down

0 comments on commit 96dec5e

Please sign in to comment.