Welcome to the upcoming version of the MinIO Documentation! The content on this page is under active development and may change at any time. If you can't find what you're looking for, check our legacy documentation. Thank you for your patience.

mc tag

Description

The mc tag command adds, removes, and lists the tags associated to a bucket or object.

Examples

Apply Tags to a Bucket or Object

Use mc tag set to apply tags to a bucket or object:

mc tag set ALIAS/PATH "TAGS"
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket or object on the S3-compatible host.

  • Replace TAGS with one or more comma-separated key-value pairs for each tag and its corresponding value.

Remove Tags from a Bucket or Object

Use mc tag remove to remove all tags from a bucket or object:

mc tag remove ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket or object on the S3-compatible host.

List Tags for a Bucket or Object

Use mc tag list to retrieve all tags for a bucket or object:

mc tag list ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket or object on the S3-compatible host.

Syntax

mc tag set

Sets the tags for a bucket or object. mc tag set overwrites any existing tags on the bucket or object.

The command has the following syntax:

mc tag set [FLAGS] TARGET "TAG1=VALUE1,[TAG2=VALUE2]"

The command accepts the following arguments:

TARGET

Required The full path to the bucket or object to which to set the --TAGS. Specify the alias of a configured S3-compatible service as the prefix to the TARGET path. For example:

mc version set play/mybucket
TAGS

One or more comma-separated key-value pairs, where each pair describes a single tag.

--versions

Directs mc tag set to operate on all object versions that exist in the bucket.

--versions requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

Use --versions and --rewind together to apply the tag all object versions which existed at a specific point in time.

--rewind

Directs mc tag set to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

--version-id, --vid

Directs mc tag set to operate only on the specified object version.

--version-id requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

mc tag remove

Removes all tags from a bucket or object.

The command has the following syntax:

mc tag remove [FLAGS] TARGET

The command accepts the following arguments:

TARGET

Required The full path to the bucket or object from which to remove tags. Specify the alias of a configured S3-compatible service as the prefix to the TARGET path. For example:

mc version remove play/mybucket
--versions

Directs mc tag remove to operate on all object versions that exist in the bucket.

--versions requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

Use --versions and --rewind together to remove the tag from object versions which existed at a specific point in time.

--rewind

Directs mc tag remove to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

--version-id, --vid

Directs mc tag remove to operate only on the specified object version.

--version-id requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

mc tag list

Lists the tags assigned to a bucket or object.

The command has the following syntax:

mc tag <CMD> [FLAGS] TARGET

The command accepts the following arguments:

TARGET

Required The full path to the bucket or object for which the command lists tags. Specify the alias of a configured S3-compatible service as the prefix to the TARGET path. For example:

mc version <CMD> play/mybucket
--versions

Directs mc tag list to operate on all object versions that exist in the bucket.

--versions requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

Use --versions and --rewind together to list all tags applied to all object versions which existed at a specific point in time.

--rewind

Directs mc tag list to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

--version-id, --vid

Directs mc tag list to operate only on the specified object version.

--version-id requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.