This is a sample project to demonstrate how to build a serverless video transcoder with AWS Lambda and ECS.
Before you begin, ensure you have met the following requirements:
- AWS account with necessary permissions
- Docker installed locally for building ECS containers
- Node.js and npm for Lambda function development
To get started with this project, follow these steps:
- Clone this repository to your local machine.
- Configure AWS CLI with your credentials and default region.
- Create S3 buckets for raw and transcoded videos (e.g.,
RawBucket
andTranscodedBucket
). - Build and deploy the Lambda function in the
./lambda
directory. - Build and deploy the ECS task using the Dockerfile and task definition in the
./ecs
directory. - Configure event triggers for the Lambda function to monitor the
RawBucket
.
- Upload a video file to S3 bucket (e.g.
RawBucket
) - S3 event triggers Lambda function (e.g.
TranscoderLambda
) - Lambda function starts ECS task (e.g.
TranscoderTask
) with the video bucket and key as environment variable - ECS downloads the video from S3 bucket (e.g.
RawBucket
) and transcodes it with ffmpeg to different resolutions (e.g. 1080p, 720p, 480p) - ECS uploads the transcoded videos to different S3 bucket (e.g.
TranscodedBucket
)
./lambda
: Lambda function source code./ecs
: ECS task definition and Dockerfile
This project is licensed under the MIT License. See the LICENSE file for details.