Image upload via Amazon API gateway and lambda

I have a REST API with API gateway and Lambda API gateway . I did not create an endpoint for uploading the profile image, which transfers the file to the Lambda function where it was changed, registers it in the database and returns the URL of the new image.

Is there any way to do this with these services? Could not find anything on the network (the only thing I found was downloading directly to S3, which requires IAM permissions, as well as an event that triggers the Lambda function, which changes the image size).

thanks

UPDATE

AWS updated APIGATEWAY and knows that you can send binaries through the endpoint
Thanks to @blue and @Manzo for commenting on it

+8
amazon-s3 file-upload aws-lambda aws-api-gateway
source share
2 answers

Uploading a file directly to S3 does not necessarily require IAM permissions. You would create an API endpoint that returns the pre-signed S3 URL , which you can then use to upload the file directly to S3. The lambda function behind the API endpoint would be the only thing that would require the correct IAM permissions for the S3 bucket.

+3
source share

Since the Gateway and Lambda APIs are currently not supported, you can transfer the file to a base64-encoded image encoded in the Gateway API, and then switch to the Lambda function. Your Lambda function can be based 64 decoded, then resized, registers it in the database and returns the URL of the new image.

+1
source share

All Articles