awslocal s3api create-bucket --bucket test --region us-east-1
awslocal s3 cp test.txt s3://test/test.txt
awslocal s3api put-object-tagging \
--bucket test \
--key test.txt \
--tagging '{"TagSet": [{ "Key": "secret", "Value": "thank you" }]}'
awslocal s3api get-object-tagging \
--bucket test \
--key test.txt
awslocal s3api copy-object \
--copy-source test/test.txt \
--key test-renamed.txt \
--tagging-directive COPY \
--bucket test
awslocal s3api list-objects --bucket test --query 'Contents[].{Key: Key, Size: Size}'
awslocal s3api get-object-tagging \
--bucket test \
--key test-renamed.txt
The tags should match
awslocal s3 mv test.txt s3://test/test2.txt
This method does not copy the existing tags
awslocal s3 cp s3://test/test.txt s3://test/test3.txt
This does copy the existing tags on the test.txt object