I need to design an image resizing service that is able to resize the image on the fly.
So the flow is as follow:
- Users send the request for image AAA.png in size 400*400 to S3 bucket
- If object isn’t there, S3 will then forward the request to lambda
- Lambda fetches the original image AAA.png from bucket and resize it, put it back into s3 as AAA_400_400.png
- Once lambda has done its job, the API Gateway permanently redirects the user to the AAA_400_400.png stored in S3.
The place I get stuck is S3 redirect the request to lambda
Wonder how I can reference the apig hostname inside my s3 resource.