Skip to content

Commit

Permalink
Added fix for script
Browse files Browse the repository at this point in the history
  • Loading branch information
qtkhajacloud committed Mar 18, 2023
1 parent 50d0ac9 commit 2ad90ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions CLI/Mar23/workshop/activity1.sh
@@ -1,5 +1,10 @@
#!/bin/bash

instanceIds=$(aws ec2 describe-instances --filters "Name=tag:Env,Values=QA" "Name=instance-state-name,Values=running" --query "Reservations[].Instances[].InstanceId" --output text)
echo "The instance ids which will be shutdown are ${instanceIds}"
aws ec2 stop-instances --instance-ids ${instanceIds}

if [[ -n $instanceIds ]]; then
echo "The instance ids which will be shutdown are ${instanceIds}"
aws ec2 stop-instances --instance-ids ${instanceIds}
else
echo "No instances found with matching criteria Env = QA"
fi

0 comments on commit 2ad90ad

Please sign in to comment.