user771
user771

Reputation: 49

Is there an option for batch tagging s3 object in AWS?

I know how to tag single s3 object from my java app. But how can i tag multiple objects at once, if i pass multiple keys ?

We are talking about a big chunk of keys. ~200k

List<Tag> newTags = new ArrayList<Tag>();
           newTags.add(new Tag("Tag for delete", "This object should be deleted"));
           amazonS3Client.setObjectTagging(new SetObjectTaggingRequest(bucketName, key, new ObjectTagging(newTags)));

I am using the above code for single object tagging.

Upvotes: 0

Views: 3275

Answers (1)

kisake
kisake

Reputation: 61

Yes, there is an option for batch tagging s3 objects in AWS.

Since you are asking for a way to do this, I recommend the s3 batch operations feature: https://aws.amazon.com/blogs/aws/new-amazon-s3-batch-operations/

You can create a manifest of s3 keys and provide the desired tags in the create job request, and it will tag all of the keys in the manifest with those tags.

Upvotes: 1

Related Questions