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?

1 Resposta
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
respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas