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
已提問 1 年前檢視次數 256 次
1 個回答
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
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南