Adityacprtm
Aditya Pratama
Site Reliability Engineer
operator/01
system status
status available
tzGMT+7
response<24h
Back to Portfolio
Static Asset Management

Static Asset Management

DevOps Engineer2025 · 3 days

A pipeline for managing static assets (images, fonts, videos) using AWS S3 for storage, Cloudflare CDN for global delivery, and GitHub Actions for automated deployment and cache invalidation.

Tech Stack

AWS S3Cloudflare CDNGitHub Actions

Architecture

Static assets are uploaded to an S3 bucket configured as a static website. Cloudflare sits in front with caching rules optimized for different file types (long TTL for hashed assets, shorter for non-hashed). A GitHub Actions workflow handles uploads on push to the main branch and triggers Cloudflare API cache purge for updated files. Asset URLs in the codebase are generated dynamically using a helper that maps local paths to the CDN URL.

Challenges & Solutions

Cache Invalidation Granularity

Cloudflare's purge-by-URL API only accepts up to 30 URLs per request. For large deploys touching hundreds of assets, a batched purge strategy was needed, splitting the URL list into chunks and sending parallel requests with exponential backoff on rate limits.

S3-to-Cloudflare Origin Consistency

Newly uploaded assets sometimes returned stale 403s because Cloudflare's edge cached an older error response. Configuring Cloudflare to honor the S3 Cache-Control header and adding a 'no-cache' bypass rule for the first request after upload resolved this.

© 2026 Aditya Chamim Pratama All systems operational