Is there a way to apply a tag (or set of tags) to all objects in an S3 directory using one single put-object-tagging cli command?
I.e if I have two files (test0.txt
, test.txt
) I can do the run the following two commands:
>aws s3api put-object-tagging --bucket mybucket --key foo/bar/test0.txt --tagging 'TagSet=[{Key=colour,Value=blue}]'
>aws s3api put-object-tagging --bucket mybucket --key foo/bar/test1.txt --tagging 'TagSet=[{Key=colour,Value=blue}]'
When trying to pass the folder itself as the --key option I get the following error (as it must reference a single object):
>aws s3api put-object-tagging --bucket mybucket --key foo/bar/ --tagging 'TagSet=[{Key=colour,Value=blue}]
An error occurred (NoSuchKey) when calling the PutObjectTagging operation: The specified key does not exist.
Is there a workaround for this?