From 96dec5e2010ffe5745a2f55712df9717af9082d2 Mon Sep 17 00:00:00 2001 From: Alex Lubneuski Date: Wed, 27 Nov 2024 13:46:45 -0500 Subject: [PATCH] :bug: Added grep -v None to exclude terminated instances --- d3b_cli_igor/utils/scripts/dev-env-tunnel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3b_cli_igor/utils/scripts/dev-env-tunnel b/d3b_cli_igor/utils/scripts/dev-env-tunnel index b1e9c03..13fd04a 100755 --- a/d3b_cli_igor/utils/scripts/dev-env-tunnel +++ b/d3b_cli_igor/utils/scripts/dev-env-tunnel @@ -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