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;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>
Comments
Post a Comment