A secure, scalable video upload service built with Go and deployed on AWS infrastructure. Users can upload MP4 videos through a REST API, with automatic storage in S3 and email notifications upon completion.
The system demonstrates production-ready patterns including Infrastructure as Code, CI/CD automation, event-driven architecture, and security-first deployment practices.
- RESTful API for video file uploads
- File Validation - Only MP4 files up to 100MB accepted
- AWS S3 Storage with UUID-based file naming
- Automatic Notifications via S3 → SNS integration
- Secure Deployment using AWS Systems Manager (no SSH keys)
- Infrastructure as Code managed with Terraform
- CI/CD Pipeline with GitHub Actions
- Backend: Go with Chi router
- Infrastructure: AWS (EC2, S3, SNS, VPC, IAM, SSM)
- IaC: Terraform
- CI/CD: GitHub Actions
- Deployment: AWS Systems Manager
POST /upload
Content-Type: multipart/form-dataParameters:
video(file): MP4 video file (max 100MB)
Response:
{
"video_id": "23c5e135-0721-4fdf-b165-05db0140eb92",
"original_filename": "video1.mp4",
"file_size": 17119326,
"status": "uploaded",
"upload_time": "2025-08-31T20:07:53Z"
}GET /healthResponse:
{
"status": "healthy",
"timestamp": "2025-08-31T20:07:53Z"
}- AWS Account with appropriate permissions
- Terraform installed
- Go 1.23+ installed
- GitHub account for CI/CD
- Clone the repository
git clone https://github.com/yourusername/aws-video-streaming-platform
cd aws-video-streaming-platform- Set up environment variables
cp .env.example .env
# Edit .env with your AWS resource names- Install dependencies
go mod tidy- Run the server
go run main.go- Test the API
curl -X POST -F "[email protected]" http://localhost:3000/upload- Deploy infrastructure
cd terraform
terraform init
terraform plan
terraform apply- Configure GitHub Secrets
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
- Configure GitHub Variables
UPLOAD_BUCKET_NAMESNS_TOPIC_ARNDEPLOYMENT_BUCKET_NAME
- Push code to trigger deployment
git push origin main| Variable | Description | Example |
|---|---|---|
UPLOAD_BUCKET_NAME |
S3 bucket for video storage | video-upload-abc123 |
SNS_TOPIC_ARN |
SNS topic for notifications | arn:aws:sns:us-east-1:123:topic |
PORT |
Server port | 3000 |
- VPC with public subnet and internet gateway
- EC2 instance (t2.micro) with IAM role
- S3 buckets for video storage and deployment artifacts
- SNS topic with email subscription for notifications
- IAM roles with least-privilege permissions
- Security groups with restricted access
- No SSH Keys: Deployment uses AWS Systems Manager
- IAM Roles: EC2 uses role-based authentication
- Least Privilege: Minimal required permissions only
- Environment Variables: No hardcoded credentials
- Input Validation: File type and size restrictions
The current architecture supports moderate traffic loads. For production scale:
- Auto Scaling Groups for horizontal scaling
- Application Load Balancer for traffic distribution
- SQS queues for asynchronous processing
- CloudFront CDN for global content delivery
- RDS/DynamoDB for persistent metadata storage
Server crashes after upload:
- Check environment variables are set correctly
- Verify SNS topic ARN is valid
SSM deployment fails:
- Ensure EC2 has
AmazonSSMManagedInstanceCorepolicy - Check SSM agent is running on EC2
File upload fails:
- Verify file is MP4 format and under 100MB
- Check S3 bucket permissions
# Check application logs on EC2
cat /home/ec2-user/app.log
# Check SSM command status
aws ssm list-command-invocations --command-id <command-id>- Fork the repository
- Create a feature branch
- Make changes and add tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Author: Neel Barvaliya
- Email: [email protected]
- GitHub: @NeilNeel
Note: This project is designed for learning purposes and demonstrates AWS cloud architecture patterns. For production use, additional security hardening and monitoring should be implemented.
