aws ec2 delete-tags
Deletes the specified set of tags from the specified set of resources. AWS CLI reference
2 examples 3 options Its page in the AWS CLI reference
Examples
Example 1: To delete a tag from a resource
The following delete-tags example deletes the tag Stack=Test from the specified image. When you specify both a value and a key name, the tag is deleted only if the tag's value matches the specified value.
aws ec2 delete-tags --resources ami-1234567890abcdef0 --tags Key=Stack,Value=TestIdentify--resourcesThe IDs of the resources, separated by spaces.--tagsThe tags to delete.This command produces no output.
It's optional to specify the value for a tag. The following delete-tags example deletes the tag with the key name purpose from the specified instance, regardless of the tag value for the tag.
aws ec2 delete-tags --resources i-1234567890abcdef0 --tags Key=purposeIdentify--resourcesThe IDs of the resources, separated by spaces.--tagsThe tags to delete.This command produces no output.
If you specify the empty string as the tag value, the tag is deleted only if the tag's value is the empty string. The following delete-tags example specifies the empty string as the tag value for the tag to delete.
aws ec2 delete-tags --resources i-1234567890abcdef0 --tags Key=Name,Value=Identify--resourcesThe IDs of the resources, separated by spaces.--tagsThe tags to delete.This command produces no output.
For more information, see Tag your Amazon EC2 resources in the Amazon EC2 User Guide.
Example 2: To delete a tag from multiple resources
The following delete-tags example deletes the tagPurpose=Test from both an instance and an AMI. As shown in the previous example, you can omit the tag value from the command.
aws ec2 delete-tags --resources i-1234567890abcdef0 ami-1234567890abcdef0 --tags Key=PurposeIdentify--resourcesThe IDs of the resources, separated by spaces.--tagsThe tags to delete.This command produces no output.
For more information, see Tag your Amazon EC2 resources in the Amazon EC2 User Guide.
Options
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.--resourcesThe IDs of the resources, separated by spaces.--tagsThe tags to delete.