Suhail Moideen
Suhail Moideen

Reputation: 55

Upload a video to s3 bucket, video details to dynamo db using lambda function

We are building an app to upload and stream short videos. Have planned to use AWS S3 and AWS Lambda functions, Dynamo DB along with AWS API Gateway to upload videos. We do have to store all video file details ex:user details in dynamo db table.

But we can find some limitations in API Gateway to upload large video files. So what is the best approach to upload videos to S3 Bucket?

Upvotes: 1

Views: 1242

Answers (1)

Radu Diță
Radu Diță

Reputation: 14181

You can upload files directly to S3 using presigned urls. By using presigned urls you keep your bucket private.

This can be done from the client (web browser) and save the S3 key or URL in DynamoDB by using API Gateway if you want.

This approach will reduce the load on your AWS servers which is desirable.

A complete solution can be something like this

  • Call to API Gateway to get a presigned url to upload the video
  • The client (web browser) does the upload using the presigned url it got
  • Call to API Gateway to notify the upload is finished, call lambda, save data in DynamoDB

Optionally you could have a lambda triggered by adding a file to S3 that does further processing to the video (probably by starting a media convert job for instance)

Upvotes: 3

Related Questions