惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
量子位
D
DataBreaches.Net
博客园 - 司徒正美
J
Java Code Geeks
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
B
Blog
The Cloudflare Blog
D
Docker
I
InfoQ
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
腾讯CDC
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
S
SegmentFault 最新的问题
GbyAI
GbyAI
有赞技术团队
有赞技术团队

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Replacing a 5-service AWS video pipeline with one API call
Mason K · 2026-06-15 · via DEV Community

Mason K

TL;DR

We had a video feature built on S3 + MediaConvert + CloudFront + a hand-rolled player + a half-finished CloudWatch dashboard. It worked, but every change touched five services. This post shows the glue code we actually ran, then the same flow as one upload call against a managed video API (FastPix here, but the pattern is identical for Mux / Cloudflare Stream / api.video). You'll see exactly what code disappears.

The setup we were maintaining

Here's the honest shape of the DIY pipeline. Upload to S3, trigger MediaConvert on the object-created event, write renditions back, serve through CloudFront. The Lambda that kicks off encoding looked roughly like this:

// lambda/triggerEncode.js - fires on S3 ObjectCreated
import { MediaConvertClient, CreateJobCommand } from "@aws-sdk/client-mediaconvert";

const mc = new MediaConvertClient({ region: "us-east-1" });

export async function handler(event) {
  const key = event.Records[0].s3.object.key;
  const input = `s3://uploads-bucket/${key}`;

  await mc.send(new CreateJobCommand({
    Role: process.env.MC_ROLE_ARN,
    Settings: {
      Inputs: [{ FileInput: input }],
      OutputGroups: [{
        Name: "Apple HLS",
        OutputGroupSettings: {
          Type: "HLS_GROUP_SETTINGS",
          HlsGroupSettings: {
            Destination: `s3://renditions-bucket/${key}/`,
            SegmentLength: 6,
            MinSegmentLength: 0,
          },
        },
        // ...one Output block PER rendition: 1080p, 720p, 480p, 360p...
        Outputs: [ /* 40+ lines of codec settings per rendition */ ],
      }],
    },
  }));
}

That Outputs array is where the weekends go. Every rendition is a block of codec settings. Every tweak to the ladder is a redeploy. And this Lambda is only the encode trigger. You still need:

  • An IAM role with the right MediaConvert + S3 permissions.
  • A second event path to know when the job finished (EventBridge → another Lambda).
  • CloudFront in front of the renditions bucket, with an OAC so the bucket isn't public.
  • A player that knows the manifest URL.
  • Something that records whether playback actually worked.

⚠️ None of these is hard. The problem is that there are five of them, and they fail independently.

The cost shape (why tuning didn't save us)

The bill wasn't one number, it was several that move on different axes:

Line item Service Scales with
Encoding MediaConvert output minutes (renditions × source)
Origin storage S3 originals + renditions retained
Delivery / egress CloudFront GB delivered (i.e. your success)
Glue compute Lambda events
QoE analytics CloudWatch + custom engineering time

MediaConvert is billed per output minute, and CloudFront egress is billed per GB, so a popular video is a bigger bill on two axes at once.1 We dropped a rendition and moved to a cheaper CloudFront price class. It trimmed the edges. It did not change the shape.

The replacement: one upload call

Here's the same upload-encode-store-deliver flow as a single request. Auth is Basic with an Access Token ID + Secret Key.

// server/createAsset.js - node 20+
const res = await fetch("https://api.fastpix.io/v1/on-demand", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Basic " + Buffer
      .from(`${process.env.FASTPIX_TOKEN_ID}:${process.env.FASTPIX_SECRET}`)
      .toString("base64"),
  },
  body: JSON.stringify({
    inputs: [{ type: "video", url: "https://your-bucket/source.mp4" }],
    // ABR ladder is generated for you; no per-rendition codec blocks
    metadata: { project: "demo" },
  }),
});

const { data } = await res.json();
console.log("playbackId:", data.playbackId);

Playback is then just an HLS URL you can hand to any player:

// app/player.js - works with hls.js, Video.js, Shaka, or the platform player
const src = `https://stream.fastpix.io/${playbackId}.m3u8`;

The 40-line-per-rendition Outputs array is gone, because the ABR ladder is generated server-side. The "did it finish" EventBridge path becomes a single webhook you subscribe to once. And the analytics project I never finished on CloudWatch ships as Video Data, free up to 100K views a month, where Mux's comparable Media plan starts at $499/month.2

Want resumable uploads from the browser instead of importing from a URL? That's the upload SDK, not a fresh S3 multipart implementation:

npm install @fastpix/upload

// app/upload.js
import { uploadFile } from "@fastpix/upload";

await uploadFile({
  endpoint: signedUploadUrl,   // created server-side via the same API
  file,                        // a File from an <input type="file">
  onProgress: (p) => setProgress(p),
});

Before / after, honestly

DIY AWS stack Managed video API
Encode trigger Lambda + MediaConvert job JSON one POST
Ladder config per-rendition codec blocks generated
Job-finished signal EventBridge → Lambda one webhook
Delivery CloudFront + OAC setup playback URL
Player hand-wrapped included or BYO
QoE analytics build it yourself included (free up to 100K views/mo)
Bill 5 line items, 5 axes usage-based, one model

On total cost, FastPix publishes a "~70% cheaper than AWS" figure, but it's tied to a specific scenario (1-minute 1080p video streamed to 500K viewers), so treat it as scenario-specific, not a blanket promise.3 The win I'd actually stand behind is predictability: one usage-based bill instead of five that move independently.

💡 Trade-off worth naming: this is an API-first approach, not a no-code video CMS. If your team wants a drag-and-drop back office with zero engineering, you'll still build a front-end on top of the API.4

What's next

  • Subscribe to processing webhooks so your UI flips from "processing" to "ready" without polling.
  • Add signed playback (JWT) if your content is gated.
  • If you're migrating an existing library, look for a batch import tool rather than scripting S3 copies by hand.
  • Compare the numbers for your delivery-to-encode ratio: FastPix pricing next to AWS MediaConvert pricing. The right answer depends on your workload, not on a blog post.

If you're at extreme sustained scale, keep self-hosting; the math flips in your favor there. For a video feature inside a product that does something else, one API call beats five services.


  1. MediaConvert per-output-minute and CloudFront per-GB egress: aws.amazon.com/mediaconvert/pricing (verify current). ↩

  2. FastPix Video Data free up to 100K views/month; Mux Data Media plan $499/month (verify Mux pricing). ↩

  3. "~70% cheaper than AWS" is FastPix's published, methodology-specific comparison (1-min 1080p, 500K viewers). ↩

  4. Approved FastPix trade-off: API-first, not a no-code CMS. ↩