LUZO
LUZO

Reputation: 1029

How to tag files in s3

i need to tag files in s3. i am using below command and its not working

aws s3api put-object-tagging --bucket dev-us-east-1 --key AXD_M/merge_1/part-00000-10b98444-ecc9-4140-851b-2499bf9c65cd-c000.snappy.parquet --tagging "TagSet=[{Key=Tag,Value=True}]"

error i am facing is below

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
{
    "VersionId": "DjAdM7zzvo4.59zkqMVix6Ow6fEP9xQE"
}

Upvotes: 0

Views: 316

Answers (1)

Darrell Plessas
Darrell Plessas

Reputation: 211

Two things. First your shell-init error is usually indicitive that the directory that you are trying to run your command has been moved or removed by another process. Try to cd you home dir or /tmp and I bet that error goes away.

Second, looking at your command, I am not sure why you have the '--key' argument, I am not sure what you are attempting to do there and I do not see it listed in the doc for the s3api. What you have here, ignoring the --key arg, would create a Tag called 'Tag' with a value of 'True' on a bucket named 'dev-us-east-1'. Are you attempting to put that --key value as the key for your tag? If so try this:

aws --profile user1 s3api put-bucket-tagging --bucket dev-us-east-1 --tagging "TagSet=[{Key=AXD_M/merge_1/part-00000-10b98444-ecc9-4140-851b-2499bf9c65cd-c000.snappy.parquet,Value=True}]"

This will create a tag called 'AXD_M/merge_1/part-00000-10b98444-ecc9-4140-851b-2499bf9c65cd-c000.snappy.parquet' with a value of 'True' for a bucket named 'dev-us-east-1'

Here is the doc for aws s3api, good luck https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-tagging.html

Upvotes: 2

Related Questions