Made by Bernardo Quina

AI Video Analysis Demo
powered by AWS

Try out this video analysis generation demo and explore how the infra is deployed in AWS.

Explore Infrastructure

Dive into this AWS-deployed event-driven architecture, its components, and how they interact.

CI/CD Workflow Overview

See how GitHub Actions deploy code changes and how CloudFormation updates the infrastructure.

Project Insights

Reflecting on challenges, learnings and decisions behind building a scalable AI video analysis platform.

The development of complex cloud-native applications presents unique challenges that extend far beyond writing code. This article delves into my experience building a comprehensive video analysis platform on AWS, highlighting the critical lessons learned about cloud architecture, infrastructure automation, and the intricacies of deploying AI-powered applications at scale.

Challenges Faced

The journey of building this platform revealed several significant challenges that tested both technical skills and project management capabilities. The most prominent challenge was the considerable scope expansion that occurred during development. What began as a seemingly straightforward demonstration of AWS capabilities evolved into an intricate system encompassing multiple microservices, AI processing pipelines, and automated deployment workflows. This scope expansion (among other things I'll go through in this article) doubled the initially projected timeline, highlighting the importance of comprehensive project planning when dealing with complex cloud architectures.

Technical complexity peaked during the implementation of the custom AI analysis model. As a Node.js developer, building and deploying a Python-based application using the Video-Llava model presented a significant learning curve. The requirement for GPU-enabled instances not only complicated the development and testing process but also introduced unique deployment challenges. Managing the model's substantial 20GB file size required careful consideration of build processes, deployment strategies, and instance startup times. The solution ultimately involved creating custom AMIs with pre-cached model files, though this introduced its own set of challenges in the CI/CD pipeline.

Cost optimization emerged as another critical challenge, particularly given the compute-intensive nature of AI video analysis. The solution required careful architectural decisions to maintain performance while minimizing expenses. This included utilizing AWS free tier services where possible, implementing scale-to-zero capabilities for GPU instances, and making strategic trade-offs between ideal architecture and cost-effective solutions. For instance, while placing services in private subnets with NAT gateways would have been architecturally preferable, the cost implications led to a security group-based approach with public subnets. Despite using more than 20 services/components the base monthly cost of the project is below 20 dollars.

Key Takeaways

The implementation of an event-driven microservices architecture proved to be a double-edged sword. While it provided exceptional system resilience and optimal resource utilization, it also significantly increased development complexity and time investment. This experience highlighted the importance of carefully weighing the benefits of distributed architectures against the increased development and maintenance overhead, particularly for solo developers or small teams, or when dealing with tight time frames for a project.

Working extensively with AWS services reinforced both the platform's capabilities and its complexities. The vast AWS ecosystem enabled the implementation of sophisticated features and robust infrastructure, but it also emphasized the critical importance of careful resource management and security considerations. The experience underscored that with great power comes great responsibility – particularly in managing costs and ensuring secure deployment configurations.

The implementation of infrastructure as code using CloudFormation and automated deployments through GitHub Actions proved invaluable. These practices not only provided consistency and predictability in deployments but also served as living documentation of the system architecture. The initial investment in setting up these automation pipelines, while substantial, paid dividends throughout the development process and would continue to do so throughout the project lifecycle if it were to continue.

Areas for Improvement

Several areas of the platform could be enhanced with additional development time. The integration of API Gateway could provide improved security through rate limiting and caching capabilities, while implementing AWS WAF for both CloudFront distributions would enhance protection against web exploits. Moving compute resources to private subnets with NAT gateways would align better with security best practices, though at an increased cost.

Technical optimizations could significantly improve system efficiency. The current thumbnail generation process could be optimized to process only relevant video segments, and a more streamlined solution for managing the analysis model image could reduce deployment complexity. The frontend user interface, while functional, could benefit from enhanced UX design to better showcase the platform's capabilities.

Perhaps most importantly, the experience has emphasized the critical importance of thorough initial planning and realistic scope assessment. Future projects I'll work on will benefit from more extensive upfront architecture design and careful consideration of implementation timelines, particularly when working with unfamiliar technologies or complex infrastructure requirements.

This project serves as a testament to the power of modern cloud platforms while highlighting the complexity of building production-ready systems. The challenges I encountered and lessons I've learned provide me valuable insights for future cloud-native application that I'll build, particularly in the realm of AI-powered services and event-driven architectures.