Closed jmcdonald24 closed 5 years ago
Thanks, very sorry for this. Resolved by https://github.com/rjurney/Agile_Data_Code_2/commit/1077843a1e3ff33530f47e1b982f937ed3aafef4
echo "Now we will tag this ec2 instance and name it 'agile_data_science_ec2' ..." | tee -a $LOG_FILE
INSTANCE_ID=`aws ec2 describe-instances | jq -c ".Reservations[] | select(.ReservationId | contains(\"$RESERVATION_ID\"))| .Instances[0].InstanceId" | tr -d '"'`
if [ ! -z "$INSTANCE_ID" ] # Only run tag if INSTANCE_ID is defined
then
echo "Got instance id \"$INSTANCE_ID\" ... tagging it ..."
aws ec2 create-tags --resources $INSTANCE_ID --tags Key=Name,Value=agile_data_science_ec2
echo "" | tee -a $LOG_FILE
else
echo "Got no instance id! Exiting!"
exit 1
fi
The ec2.sh script is tagging all instances in the region (even pre-existing, unrelated instances) not just the newly created one.