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
질문됨 일 년 전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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠