RBCloud & DevOpsTHE PRACTICAL LEARNING LIBRARY
By Ravindra BagaleResources

CHAPTER 56 / 60

Project 1 — Architecture and resource plan

Build a working vertical-video feed with EC2, Nginx, PHP, MySQL/RDS and the AWS SDK for S3.

Concept + practical labBy Ravindra Bagale · ~5 min read · lab time additional

Why this project

A real application makes service boundaries visible. Nginx serves the interface, PHP validates requests, RDS stores captions and object keys, and private S3 stores video bytes. The browser receives a short-lived media URL rather than AWS credentials. This is a single-admin teaching application, not a production social network.

Request flow

  1. A visitor opens the feed over HTTPS and requests api.php?action=feed.
  2. PHP reads the latest post metadata from MySQL using PDO.
  3. The AWS SDK creates a short-lived signed GET URL for each private S3 object.
  4. The browser displays vertical videos and captions. It downloads media directly from S3.
  5. An administrator signs in, uploads a video and caption, or updates an existing caption.
  6. PHP validates the upload, writes the object using the EC2 role and inserts its key into MySQL.

Component contract

ComponentStores/doesDoes not store/do
EC2 + NginxStatic UI, reverse execution to FPMPermanent video library
PHP-FPMAuth, CSRF, validation, SDK/PDO callsBrowser-visible AWS keys
RDS MySQLPost ID, caption, key, timestampsVideo binary files
Private S3MP4/WebM objects under reels/SQL rows or application sessions
EC2 IAM roleScoped object permissionsSQL username/password

Resource plan

Use one lab Region, a VPC, a public web subnet and private DB subnets across two AZs. A simple teaching deployment exposes the web instance via HTTPS; an advanced deployment can place it behind an ALB. The provided Nginx configuration assumes direct TLS termination on the instance after certificate setup. Keep S3 Block Public Access enabled. Use web-sg for 80/443 and restricted management, and db-sg with 3306 only from web-sg. Choose small resources after checking current cost. Record a teardown owner/time before launch.

Included implementation

The package's project/ folder contains PHP API, feed/admin pages, schema, example private configuration, IAM policy and Nginx configuration. Download the project from the course Resources area. The application supports upload, paginated feed and caption update; it deliberately has no public registration, comments, recommendations or transcoding pipeline.

Acceptance criteria

A valid admin can publish a short video; visitors can play it; caption updates persist; unsigned direct S3 access fails; unauthenticated writes fail; secrets cannot be fetched from the document root. The later project chapters provide the runbook and test cases.

Ravindra’s Tip

Video को database में भरने की जरूरत नहीं है। Video S3 में रखो और उसका object key तथा caption MySQL में—हर service को उसका सही काम दो।

Official reference

AWS SDK for PHP S3 examples

Interview and revision check

Why store an object key instead of a permanent signed URL in MySQL?

The key identifies durable media. Signed URLs expire and should be generated when authorized access is needed.

Ravindra Bagale · Cloud & DevOps Academy · Handbook and project downloads