Remove specific tags from EC2 instance?

COUNTER=0
for instance_id in `aws ec2 describe-instances --query "Reservations[*].Instances[*].{Instance:InstanceId}"  --filters "Name=tag:Name,Values=*<common_name>*"  --output text --region <region_name>`
do
let COUNTER++
printf $COUNTER;
echo ". Removing the tag for the instance "$instance_id;
aws ec2 delete-tags --resources $instance_id --tags Key=<Tag_That_needs_Removal>
done;

Comments

Popular posts from this blog

Logical volume vmxxxx_img is used by another device - Error on LVM removal

Open VZ cheat Sheet

Cheat sheet for Hardware RAID health check - Megaraid, Adaptec, 3wareraid and HPraid.