<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ANSHUL VAIBHAV</title>
    <description>The latest articles on DEV Community by ANSHUL VAIBHAV (@anshul_vaibhav_1f725e0621).</description>
    <link>https://dev.to/anshul_vaibhav_1f725e0621</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4190897%2F77a4a219-764a-4517-9622-b0972031567d.png</url>
      <title>DEV Community: ANSHUL VAIBHAV</title>
      <link>https://dev.to/anshul_vaibhav_1f725e0621</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anshul_vaibhav_1f725e0621"/>
    <language>en</language>
    <item>
      <title>Working with S3 Object Tags in Buckets: SET, MERGE and CLEAR</title>
      <dc:creator>ANSHUL VAIBHAV</dc:creator>
      <pubDate>Sat, 17 Oct 2026 17:29:41 +0000</pubDate>
      <link>https://dev.to/anshul_vaibhav_1f725e0621/working-with-s3-object-tags-in-buckets-set-merge-and-clear-3dak</link>
      <guid>https://dev.to/anshul_vaibhav_1f725e0621/working-with-s3-object-tags-in-buckets-set-merge-and-clear-3dak</guid>
      <description>&lt;p&gt;A practical walkthrough for keeping Amazon S3 objects organized without changing what is inside the files.&lt;/p&gt;

&lt;p&gt;Object tags are easy to overlook when you are busy uploading and moving files around S3. But once a bucket starts filling up, a few consistent labels can make objects easier to organize and manage. The part that matters is how you update them: replacing a tag set is not the same as adding a tag to what is already there.&lt;/p&gt;

&lt;p&gt;I used Buckets by Serverless Creed to explore three useful actions—SET, MERGE and CLEAR—and checked the results in the AWS S3 console. I also compared the downloaded files with their original SHA-256 hashes to make sure the contents stayed exactly the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick look at object tags
&lt;/h2&gt;

&lt;p&gt;An S3 object tag is a key-value pair attached to an object. For example, &lt;code&gt;env=test&lt;/code&gt;, &lt;code&gt;team=intern&lt;/code&gt; or &lt;code&gt;phase=review&lt;/code&gt; can describe where a file belongs or how it is used. These are separate from the file itself and from ordinary user-defined object metadata. S3 allows up to ten tags per object.&lt;/p&gt;

&lt;p&gt;Tags can be useful for organizing data and for AWS features that are configured to use them, including lifecycle rules and some access-control policies. That is why updating tags deserves a little more care than simply changing a filename.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with a small sample folder
&lt;/h2&gt;

&lt;p&gt;I worked with a handful of harmless text files in a private S3 bucket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  docs/readme.txt
  b.txt
  c.txt
  control.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The files were small enough to inspect easily. The bulk operations shown below target only &lt;code&gt;b.txt&lt;/code&gt; and &lt;code&gt;c.txt&lt;/code&gt;. I left &lt;code&gt;control.txt&lt;/code&gt; with a separate &lt;code&gt;control=keep&lt;/code&gt; tag so there was always an object to compare against the ones being updated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fabmolyt39u7il6hsbss4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fabmolyt39u7il6hsbss4.png" alt="The sample files as they appear in the Buckets object browser." width="799" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The sample files as they appear in the Buckets object browser.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SET: replace the existing tags
&lt;/h2&gt;

&lt;p&gt;SET is the option to choose when an object needs a completely new tag set. In Buckets, select the files, open the bulk tagging action and choose &lt;strong&gt;Set (replace)&lt;/strong&gt;. For this example, I entered &lt;code&gt;team=intern&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The important word is &lt;em&gt;replace&lt;/em&gt;: tags that were on the object before, but are not included in the new set, will be removed. Before applying the change, the dialog shows the exact object keys being updated. It is worth reading that list rather than assuming every visible folder or file is included.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn1nosz9w6g668igls2oe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn1nosz9w6g668igls2oe.png" alt="SET preview in Buckets, with the new team tag and the exact object list." width="783" height="900"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;SET preview in Buckets, with the new team tag and the exact object list.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmxkbfv13du0l7s1tfv42.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmxkbfv13du0l7s1tfv42.png" alt="The operation completes and Buckets displays the update result." width="784" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The operation completes and Buckets displays the update result.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Buckets reported &lt;strong&gt;Updated: 2, Failed: 0&lt;/strong&gt; for SET.&lt;/p&gt;

&lt;p&gt;I then opened the object details in AWS. The tag panel showed one tag, &lt;code&gt;team=intern&lt;/code&gt;, which is the state I expected after a replacement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqohjevhk00n70mbpbv55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqohjevhk00n70mbpbv55.png" alt="AWS S3 shows the new tag set after SET." width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AWS S3 shows the new tag set after SET.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  MERGE: add a tag without losing the others
&lt;/h2&gt;

&lt;p&gt;MERGE is more useful when the existing labels should stay. I kept &lt;code&gt;team=intern&lt;/code&gt;, switched to &lt;strong&gt;Merge&lt;/strong&gt;, and entered a new tag: &lt;code&gt;phase=review&lt;/code&gt;. I left the remove-keys field empty.&lt;/p&gt;

&lt;p&gt;That should leave both tags on the objects. If a tag key already exists, MERGE updates that key; keys not mentioned are preserved. This is usually a safer option for incremental changes than rebuilding the full tag list by hand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1gt1nlryalujbgq0xo8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1gt1nlryalujbgq0xo8.png" alt="MERGE adds phase=review while preserving the other tag keys." width="784" height="1011"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;MERGE adds phase=review while preserving the other tag keys.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foc14virg4qj8o739slcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foc14virg4qj8o739slcm.png" alt="The MERGE action completes successfully." width="784" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The MERGE action completes successfully.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Buckets reported &lt;strong&gt;Updated: 2, Failed: 0&lt;/strong&gt; for MERGE.&lt;/p&gt;

&lt;p&gt;The AWS object details now displayed both &lt;code&gt;team=intern&lt;/code&gt; and &lt;code&gt;phase=review&lt;/code&gt;. Checking the entire tag list is useful here: seeing only the new key would not prove that the earlier one survived.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fznkxrtzidremsvxe95qy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fznkxrtzidremsvxe95qy.png" alt="Both team and phase are visible in the AWS object-tag panel." width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Both team and phase are visible in the AWS object-tag panel.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CLEAR: remove tags, not the object
&lt;/h2&gt;

&lt;p&gt;CLEAR does exactly what the name suggests: it removes the object’s tag set. In Buckets, choose &lt;strong&gt;Clear all&lt;/strong&gt; after selecting the intended files. The confirmation makes the scope explicit and warns that tag-dependent lifecycle rules or policies may no longer match.&lt;/p&gt;

&lt;p&gt;This is the step where I would be most careful in a real bucket. Clearing tags does not delete a file, but tags may be used by other AWS configurations. Always check the objects listed in the confirmation before proceeding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8ptxsa8fvj5xk8cryctu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8ptxsa8fvj5xk8cryctu.png" alt="CLEAR warns about removing all tags and shows the affected object keys." width="800" height="826"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;CLEAR warns about removing all tags and shows the affected object keys.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcvry36pqezxxeexn1gbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcvry36pqezxxeexn1gbm.png" alt="Buckets confirms that the tag-removal operation completed." width="784" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Buckets confirms that the tag-removal operation completed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Buckets reported &lt;strong&gt;Updated: 2, Failed: 0&lt;/strong&gt; for CLEAR.&lt;/p&gt;

&lt;p&gt;Afterward, the AWS object details showed &lt;strong&gt;Tags (0)&lt;/strong&gt;. The AWS object details still identified &lt;code&gt;b.txt&lt;/code&gt;; the wider Buckets capture also shows &lt;code&gt;readme.txt&lt;/code&gt; remaining in the browser after tag removal. That distinction is important: removing tags is not the same thing as deleting objects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhin9voz6vf1lg8yrnfnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhin9voz6vf1lg8yrnfnz.png" alt="The S3 tag section is empty after CLEAR." width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The S3 tag section is empty after CLEAR.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjz19mjh1zo1j5pzj5pvt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjz19mjh1zo1j5pzj5pvt.png" alt="A wider view of the Buckets object browser after tag removal." width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A wider view of the Buckets object browser after tag removal.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuou5dsfkltcz7orqkqdk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuou5dsfkltcz7orqkqdk.png" alt="The AWS object details page still shows the file and its empty tag set." width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The AWS object details page still shows the file and its empty tag set.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Independent verification and SHA-256 integrity checking
&lt;/h2&gt;

&lt;p&gt;I kept &lt;code&gt;control.txt&lt;/code&gt; out of the tagging changes. Its &lt;code&gt;control=keep&lt;/code&gt; tag was still there at the end, which was a quick check that the untouched object had retained its original tag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdpwgs1oa90m2b3zaswcw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdpwgs1oa90m2b3zaswcw.png" alt="The control object keeps its original tag." width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The control object keeps its original tag.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For file contents, I recorded SHA-256 hashes of the original text files before uploading them. After the tagging sequence, I downloaded the S3 objects into a separate folder and compared them with that original hash list. Run the check from the download folder, with the original hash list one directory above it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shasum -a 256 -c ../original-hashes.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgt152j9kfaz411us88i7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgt152j9kfaz411us88i7.png" alt="All four downloaded files match their original SHA-256 hashes." width="602" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All four downloaded files match their original SHA-256 hashes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The output was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs/readme.txt: OK
b.txt: OK
c.txt: OK
control.txt: OK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AWS Console screenshot lists CRC64NVME as its stored checksum function. The SHA-256 verification here is a separate local comparison of the downloaded bytes against the original files.&lt;/p&gt;

&lt;p&gt;All four checks returned &lt;code&gt;OK&lt;/code&gt;. That gives two independent views of the outcome: the AWS Console shows how the tags changed, and the hash check shows that the downloaded file bytes matched the originals.&lt;/p&gt;

&lt;h2&gt;
  
  
  A few habits worth keeping
&lt;/h2&gt;

&lt;p&gt;Three things made this workflow straightforward. First, use &lt;strong&gt;SET&lt;/strong&gt; only when replacing the full tag set is intentional; use &lt;strong&gt;MERGE&lt;/strong&gt; when existing labels should remain. Second, review the exact object list before any bulk operation, especially when folders and nested files are involved. Third, check the resulting tags in S3 rather than relying on a success message alone.&lt;/p&gt;

&lt;p&gt;For a small example like this, the difference between SET, MERGE and CLEAR is easy to see. On a busy bucket, choosing the right operation—and verifying the final state—can save a lot of confusion later.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
