Object tags are key-value pairs that can be attached to objects in S3-compatible object storage. You can label and sort items by purpose, project, environment or content type.
For example, you might tag a file with project=website, environment=production, or type=backup.
You can manage your object tags in Cyberin S3 Object Storage with an S3-compatible API client or the AWS CLI. This article covers how to get existing tags, add or replace tags, and delete tags on an object.
Set up your S3 compatible client with your Space’s access key, secret key and regional endpoint.
For the AWS CLI, you can specify the endpoint directly in each command:
--endpoint-url https://YOUR_REGION.digitaloceanspaces.comReplace YOUR_REGION with your Space's actual region, such as sgp1.
Never share your access key and secret key with anyone. Do not store credentials in publicly available scripts or share them in support requests.
You can use the get-object-tagging command to get a list of the current tags that are associated with an object.
aws s3api get-object-tagging \
--bucket YOUR_SPACE_NAME \
--key path/to/your-file.pdf \
--endpoint-url https://YOUR_REGION.digitaloceanspaces.comReplace the placeholders with your Space name, object key, and regional endpoint.
If the object has tags, the response contains a TagSet with its key-value pairs. For example:
{
"TagSet": [
{
"Key": "project",
"Value": "website"
},
{
"Key": "environment",
"Value": "production"
}
]
}If the object has no tags, the response may contain an empty TagSet.
Use the put-object-tagging command to assign tags to an object.
For example, the following command assigns two tags:
aws s3api put-object-tagging \
--bucket YOUR_SPACE_NAME \
--key path/to/your-file.pdf \
--tagging 'TagSet=[{Key=project,Value=website},{Key=environment,Value=production}]' \
--endpoint-url https://YOUR_REGION.digitaloceanspaces.comUpdate the space name, object key, endpoint, and tag values as required.
Important: This operation overwrites the existing tags of the object with the tags you provide. Important new tags are not automatically included in the active tag set. To be able to keep existing tags, you have to get them first and add the tags you want to keep to the new request.
After you assign tags, run get-object-tagging again.
check space
Expected tag names
All keys have correct values.
They have the tags you wanted to keep.
If the response does not have the tags you expect, verify that the update was successful and that you are viewing the correct space and object key.
If you no longer need the tags on an object, delete them with the delete-object-tagging command.
aws s3api delete-object-tagging \
--bucket YOUR_SPACE_NAME \
--key path/to/your-file.pdf \
--endpoint-url https://YOUR_REGION.digitaloceanspaces.comThis removes the object's tag set. It does not delete the object or its file contents.
To verify the result, run get-object-tagging again and check that the tag set is empty.
Access Denied Your Access Is The key cannot read/write tags of the object . You must have read permission on the tags you want to read and object-level write permission to add or delete tags.
No tags found. Make sure you are using the right Space and object key. It may be that an empty tag set means that no tags were assigned.
When you update you delete the existing tags: The put-object-tagging operation overwrites the current tag set. Fetch the existing tags, modify the tags you want to keep and add the tags you want.
Object not found; Check Space name, object key and region. Object keys should correspond to the stored file path and name;
API request failed, please ensure your credentials are configured correctly and the endpoint points to your Space's region. For the permissions required for the API operation, see the official reference.