Bucket and Object Tagging

Telnyx Storage allows you to apply tags to buckets and objects. These tags are metadata that you can use to organize, search, and manage your buckets and objects.

Object tags

  • Object tags can be added, modified, or deleted at any time.
  • Object tags can be applied to both existing and new objects.
  • Each object can have up to 10 tags.
  • Each tag has a key and a value. Keys can be up to 128 characters in length, and values can be up to 256 characters in length.

To add a tag onto your object, pass the x-amz-tagging header with the applicable key value pair in either the PutObject or CreateMultipart request. For example:

Copy
Copied
curl --location --request PUT 'https://storage.telnyx.com/mybucket/testtagobjec1t' \
--header 'x-amz-server-side-encryption: 1' \
--header 'x-amz-tagging: key1=value1' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=host;x-amz-server-side-encryption, Signature=236dccc74d7836d6cd3d4e94839ee1100fe20010ce0273c92311d04b172a3d06' \
--header 'Content-Type: image/png' \
--data-binary '@/{{file_directory_path}}'

Note: After pasting the above content, Kindly check and remove any new line added

You can also add or update tags for an object that has already been created. To do so, perform the PutObject request again for the specified object while including the tagging filter in the url path and the tag set in the body of the request. Any tags that were originally associated with that object will be overwritten. For example:

Copy
Copied
curl --location --request PUT 'https://storage.telnyx.com/mybucket/testtagobject?tagging' \
--header 'x-amz-server-side-encryption: 1' \
--header 'X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-server-side-encryption, Signature=7eb817b33233db64d5ef8f107e7e4e2d9e57584a5665d947669ea916d87efc46' \
--header 'Content-Type: application/xml' \
--data-raw '<Tagging><TagSet><Tag><Key>key2</Key><Value>value2</Value></Tag></TagSet></Tagging>'

Note: After pasting the above content, Kindly check and remove any new line added

To apply multiple tags to an object, you can use the tag header and separate each key-value pair using an & symbol. You can also include multiple tags in the request body of the PutObject request with the tagging filter applied. Both examples are listed below:

Copy
Copied
Request - tags in header:

curl --location --request PUT 'https://storage.telnyx.com/mybucket/testtagobject2' \
--header 'x-amz-server-side-encryption: 1' \
--header 'x-amz-tagging: key1=value1&key2=value2' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=host;x-amz-date;x-amz-server-side-encryption, Signature=236dccc74d7836d6cd3d4e94839ee1100fe20010ce0273c92311d04b172a3d06' \
--header 'Content-Type: image/png' \
--data-binary '@/{{file_directory_path}}'


Request - tags in body of request:

curl --location --request PUT 'https://storage.telnyx.com/mybucket/testtagobject2?tagging' \
--header 'x-amz-server-side-encryption: 1' \
--header 'X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-server-side-encryption, Signature=7eb817b33233db64d5ef8f107e7e4e2d9e57584a5665d947669ea916d87efc46' \
--header 'Content-Type: application/xml' \
--data-raw '<Tagging><TagSet><Tag><Key>key3</Key><Value>value3</Value></Tag><Tag><Key>key4</Key><Value>value4</Value></Tag></TagSet></Tagging>'

Note: After pasting the above content, Kindly check and remove any new line added

To view the tags on your object, include the tagging filter in the path of a GetObject request. For example:

Copy
Copied
Request:

curl --location --request GET 'https://storage.telnyx.com/mybucket/testtagobject2?tagging' \
--header 'Accept: application/octet-stream' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=accept;host, Signature=bac7f4102a21c37a877d751a479f6cf1fbd86acd5af353ec4e0ded0d04e093d9'

Response:

<Tagging><TagSet><Tag><Key>key3</Key><Value>value3</Value></Tag><Tag><Key>key4</Key><Value>value4</Value></Tag></TagSet></Tagging>

Note: After pasting the above content, Kindly check and remove any new line added

To delete tags from your object, perform the DeleteObject request with the tagging filter applied. With the filter applied, only the tags will be deleted. For example:

Copy
Copied
curl --location --request DELETE 'https://storage.telnyx.com/mybucket/testtagobject?tagging' \
--header 'X-Amz-Date: 20230122T164546Z' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=host, Signature=cd3bda1008140985e28ba5a49ffb434fcdc29f5c4a84222ecd916d58513e9460'

Note: After pasting the above content, Kindly check and remove any new line added

Bucket Tags

  • Bucket tags can be added, modified, or deleted at any time.
  • Bucket tags can be applied to both existing and new buckets.
  • Each bucket can have up to 10 tags.
  • Each tag has a key and a value. Keys can be up to 128 characters in length, and values can be up to 256 characters in length.

To add a tag when creating a bucket, perform a CreateBucket request while including the tagging filter in the url path and the tag set in the body of the request. For example:

Copy
Copied
curl --location --request PUT 'https://storage.telnyx.com/buckettag1?tagging' \
--header 'Accept: text/xml' \
--header 'X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=accept;host;x-amz-content-sha256,
Signature=e980a6d82034690505f284ca89d16c39d1d5a246e40af74e28bf6a65718dbfcc' \
--header 'Content-Type: application/xml' \
--data-raw '<Tagging><TagSet><Tag><Key>key1</Key><Value>value1</Value></Tag></TagSet></Tagging>'

Note: After pasting the above content, Kindly check and remove any new line added

To view the tags on your bucket, include the tagging filter in the path of a GetBucket request. For example:

Copy
Copied
Request:

curl --location --request GET 'https://storage.telnyx.com/buckettag1?tagging' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230120/test/execute-api/aws4_request, SignedHeaders=host, Signature=b01685fcf67346b19184488d48da3e9a4145cb6d59eb3f402578c177b3dc5a05

Response:

<Tagging><TagSet><Tag><Key>key1</Key><Value>value1</Value></Tag></TagSet></Tagging>

Note: After pasting the above content, Kindly check and remove any new line added

You can add or update tags for a bucket that has already been created. To do so, perform the CreateBucket request again for the specified bucket while including the tagging filter in the url path and the tag set in the body of the request. Any tags that were originally associated with that bucket will be overwritten. For example:

Copy
Copied
curl --location --request PUT 'https://storage.telnyx.com/buckettag1?tagging' \
--header 'Accept: text/xml' \
--header 'X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=accept;host;x-amz-content-sha256,
Signature=e980a6d82034690505f284ca89d16c39d1d5a246e40af74e28bf6a65718dbfcc' \
--header 'Content-Type: application/xml' \
--data-raw '<Tagging><TagSet><Tag><Key>key2</Key><Value>value2</Value></Tag></TagSet></Tagging>'

Note: After pasting the above content, Kindly check and remove any new line added

To delete the tags on a bucket, perform the DeleteBucket request with the tagging filter applied. With the filter applied, only the tags will be deleted. For example:

Copy
Copied
curl --location --request GET 'https://storage.telnyx.com/buckettag1?tagging' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential={{your_telnyx_api_key_here}}/20230122/test/execute-api/aws4_request, SignedHeaders=host,
Signature=641921dbf70af9219bab05de8d815279d487b8c08de31efa24a452f4e3e3f050'

Note: After pasting the above content, Kindly check and remove any new line added