Saltar al contenido

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?

preguntada hace 2 años935 visualizaciones

2 Respuestas
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.

EXPERTO

respondido hace 2 años

EXPERTO

revisado hace 2 años

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

EXPERTO

respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.