1

I am new to AWS and trying to do a poc : I am sending a video file via REST API in my request and my api gateway takes that video file and transfers it to the lambda and lambda handler has further code in java to store that video file on s3. I am sending request via postman and I have set content type in postman as multipart/form-data. My video size is between 1mb to 10mb. After thorough research I am stuck in some issues:

  • How can I configure API gateway to accept video in binary? Means what should I set in body mapping template in Integration Request as I have found that multipart/form-data is not completely supported by Api gateway. What should I set in the content type in API Gateway instead of multipart/form-data ?

  • Should I create a blank lambda function from console or should try image processing service while selecting lambda blueprint?(I have tried both image processing does not work with video files)

  • In my lambda RequestHandler, in which format should I accept request, as video file cannot come in Json nor I can use RequestStreamHandler as it accepts files in Json format only.

Pallavi Kaushik
  • 159
  • 1
  • 3
  • 16
  • The API gateway does not handle `multipart/form-data`. See [this post](https://stackoverflow.com/questions/41557109/aws-api-gateway-form-data-support?rq=1) for one possible workaround. Personally I would recommend a different direction. – stdunbar Aug 01 '17 at 17:47
  • Thanks a lot but I have followed the recommended post. But which other approach can be taken to solve this issue? – Pallavi Kaushik Aug 01 '17 at 17:54
  • 1
    I would generate a presigned URL to upload into an S3 bucket - [see these docs for presigned url upload](http://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObject.html) - and, if you needed to manipulate the file, trigger a Lambda from S3 - [see these docs for S3 to Lambda](http://docs.aws.amazon.com/lambda/latest/dg/with-s3.html) – stdunbar Aug 01 '17 at 18:02
  • Ok. But is there any other way in which I can configure my API gateway and lambda to receive video files except multipart/form-data? – Pallavi Kaushik Aug 01 '17 at 18:08
  • I completed that poc and accepted video base64 data in json format at lambda handler and then encrypted and decrypted it. That completed my poc. However there is a limitation to that API Gateway is not able to handle data more than 4.4mb – Pallavi Kaushik Aug 18 '17 at 04:53

0 Answers0