Can we add more than one tag at the Time of putting an object?

0

If I am trying to put an object in the bucket. At the same time I am trying to put more than one tag to the object. Is it possible?

asked a year ago688 views
2 Answers
0

Hi,

If you want to add multiple tags to an object in S3, you can do that. This documentation shows you how to do: https://docs.aws.amazon.com/AmazonS3/latest/userguide/tagging-managing.html

To create multiple tags when performing a put operations on S3 bucket, you can use put-object. https://awscli.amazonaws.com/v2/documentation/api/2.0.34/reference/s3api/put-object.html

aws s3api put-object --bucket my-example-bucket --key example.txt --body example.txt --tagging "Environment=Production&Department=IT&Project=Migration"

You can also use other ways like Console, SDKs to add multiple tags to an Object when uploading it: https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html#:~:text=To%20upload%20folders%20and%20files,Choose%20Upload.

EXPERT
answered a year ago
AWS
EXPERT
reviewed a year ago
0

Hi,

Yes, you can put multiple tags. As you can see from the Python API: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/put_object_tagging.html

As you can see below: TagSet in Tagging below is a list of pair tags: you can put the number you want.

response = client.put_object_tagging(
    Bucket='string',
    Key='string',
    VersionId='string',
    ContentMD5='string',
    ChecksumAlgorithm='CRC32'|'CRC32C'|'SHA1'|'SHA256',
    Tagging={
        'TagSet': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    },
    ExpectedBucketOwner='string',
    RequestPayer='requester'
)

Best,

Didier

AWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions