Pass additional information to Lambda triggered by S3EventNotification

0

I have an architecture were a client uploads an image to an S3 bucket and this upload triggers a Lambda function through an S3 event notification.

This Lambda does some pre-processing on this image and then saves it on another bucket under the client's folder. However, this Lambda function does not know who the user is and thus cannot save the image in the user's folder .

If the Event Notification was able to pass some extra information, like user ID, to the Lambda this could be done.

Is there a way to do this or an alternative solution?

apssg
demandé il y a un an256 vues
1 réponse
0

When the client uploads the image to S3 add a metadata to it which contains some user information. A sample of how to add a metadata is demonstrated in the link below https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/s3-example-upload-bucket-item-with-metadata.html

Now in your Lambda you can read the metadata object using s3.head_object(Bucket=bucket, Key=key)

AWS
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions