How to add an item in a collection in amazon s3?


I have this code for create a data collection:

import boto3

def createCollection():
        cliente = boto3.client('rekognition')
        respuesta = cliente.create_collection (CollectionId = 'Fotos')
        print (respuesta)


But my question is how to add an item in this collection.
Could you please help me.

Asked By: Sebastian Moncada



Assuming you’re trying to add an image to the collection from your local filesystem, you can do so with the index_faces() method:

with open('image.png', 'rb') as image:
    respuesta = cliente.index_faces(Image={'Bytes':}, CollectionId='Fotos')
    print respuesta
Answered By: Mangohero1