Migration Playbook
Migrate from Cloudinary to Cloudizero
How to migrate your media assets from Cloudinary to Cloudizero Zero-Egress Storage with zero downtime and slash bandwidth costs by up to 85%.
1. Why Modern Teams Switch from Cloudinary
Cloudinary (Legacy)
Opaque transformation credit tax, rigid bandwidth quotas, and an intimidating dashboard requiring costly DAM enterprise add-ons.
Cloudizero (Zero-Egress)
100% free bandwidth egress forever, direct presigned uploads, and an intuitive Google Drive-familiar UI for marketing and content teams.
2. Automated Batch Stream Migration Script
This TypeScript script streams assets directly from your Cloudinary URLs into Cloudizero via @cloudizero/sdk without saving files to disk:
scripts/migrate-from-cloudinary.ts
// scripts/migrate-from-cloudinary.ts
import { Cloudizero } from "@cloudizero/sdk";
const cz = new Cloudizero({
apiKey: process.env.CLOUDIZERO_API_KEY!,
});
interface CloudinaryAsset {
publicId: string;
url: string;
fileName: string;
mimeType: string;
folder?: string;
}
/**
* Streams assets directly from Cloudinary URLs into Cloudizero Zero-Egress Storage
* without saving heavy files to your local disk.
*/
export async function migrateAssetToCloudizero(asset: CloudinaryAsset) {
console.log(`Fetching ${asset.fileName} from Cloudinary...`);
// 1. Fetch binary stream from Cloudinary
const response = await fetch(asset.url);
if (!response.ok) throw new Error(`Failed to fetch ${asset.url}`);
const buffer = Buffer.from(await response.arrayBuffer());
// 2. Upload directly to Cloudizero Project & Folder
const uploaded = await cz.storage.upload({
file: buffer,
fileName: asset.fileName,
mimeType: asset.mimeType,
projectId: process.env.CLOUDIZERO_PROJECT_ID!,
});
console.log(`✅ Migrated! Cloudizero CDN: ${uploaded.url} ($0.00 egress)`);
return uploaded;
}3. Updating Frontend Delivery URLs
Replace Cloudinary image URLs with Cloudizero global Anycast CDN endpoints:
lib/media.ts
// lib/media.ts
/**
* Simple helper to transition from Cloudinary URL pattern to Cloudizero Global CDN
*/
export function getOptimizedMediaUrl(pathOrUrl: string): string {
if (pathOrUrl.startsWith("https://res.cloudinary.com/")) {
const filename = pathOrUrl.split("/").pop();
return `https://cdn.cloudizero.com/demo/${filename}`;
}
return pathOrUrl;
}