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
gefragt vor einem Jahr256 Aufrufe
1 Antwort
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
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen