lib/aws_ec2/scripts/auto_terminate/functions.sh in aws-ec2-1.4.5 vs lib/aws_ec2/scripts/auto_terminate/functions.sh in aws-ec2-1.4.6
- old
+ new
@@ -8,10 +8,12 @@
SOURCE_AMI_ID=$(curl -s http://169.254.169.254/latest/meta-data/ami-id)
AMI_ID=$(cat /opt/aws-ec2/data/ami-id.txt | jq -r '.ImageId')
if [ "$SOURCE_AMI_ID" = "$AMI_ID" ]; then
echo "The source ami and ami_id are the same: $AMI_ID"
- echo "WILL NOT TERMINATE!"
+ echo "Will not terminate the instance for this case."
+ echo "This case can happen when an /etc/rc.local script to auto-terminate the "
+ echo "instance was capture from a previous AMI build."
return
fi
INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
SPOT_INSTANCE_REQUEST_ID=$(aws ec2 describe-instances --instance-ids "$INSTANCE_ID" | jq -r '.Reservations[].Instances[].SpotInstanceRequestId')