BARUTeam, Domain & Bundle
Diskon 30%!
Detail
s3object-storagefile-uploadcloud-storager2helipod

Integrasi S3 Object Storage di Helipod: File Storage Cloud untuk Aplikasi

Tim Helipod

6 menit baca

Cara setup S3-compatible object storage di Helipod. Upload file, gambar, dan documents ke cloud storage yang scalable dan murah.

Setiap aplikasi butuh simpan file — gambar user, documents, videos, backups. Tapi simpan file di server sendiri itu ribet: manage disk space, handle backup, dan scaling susah.

Sekarang ada cara yang lebih mudah.

Helipod sekarang terintegrasi dengan S3-compatible object storage — termasuk AWS S3, Cloudflare R2, dan provider lainnya. Dengan integrasi ini, kamu bisa upload dan serve file ke cloud storage yang scalable dan cost-effective.

Kenapa Object Storage?

Masalah File Storage Traditional

Server kamu:
├── public/
│   ├── uploads/
│   │   ├── user-123-avatar.jpg (2MB)
│   │   ├── user-456-photo.png (5MB)
│   │   └── document-789.pdf (10MB)
│   └── total: 50GB
└── Disk: 100GB (50% used)

Masalah:

  • Disk space terbatas
  • Backup ribet
  • Scaling susah
  • CDN ga ada
  • Cost tinggi

Solusi Object Storage

Cloud Storage (S3/R2):
├── Buckets: helipod-uploads
├── Files: 100,000+ objects
├── Storage: 5TB
├── Bandwidth: Unlimited
└── Cost: $0.023/GB/bulan

Hasilnya:

  • Storage unlimited
  • Backup otomatis
  • Scaling otomatis
  • CDN built-in
  • Cost rendah

Kenapa S3-Compatible?

Provider Storage Cost Bandwidth Free Tier
AWS S3 $0.023/GB $0.09/GB 5GB/12 bulan
Cloudflare R2 $0.015/GB Gratis 10GB gratis
DigitalOcean Spaces $5/bulan Gratis 100GB

Keunggulan S3-Compatible

  • Standard API — Sama untuk semua provider
  • Migrasi mudah — Pindah provider tanpa ubah kode
  • Cost-effective — Bayar sesuai pemakaian
  • Scalable — Tanpa batas
  • Reliable — 99.999999999% durability

Cara Integrasi S3 ke Helipod

Langkah 1: Pilih Provider

Opsi A: Cloudflare R2 (Recommended)

  1. Buka dash.cloudflare.com
  2. Masuk ke R2 Object Storage
  3. Klik Create bucket
  4. Catat Account ID, Access Key, dan Secret Key

Opsi B: AWS S3

  1. Buka AWS Console
  2. Masuk ke S3
  3. Klik Create bucket
  4. Buat IAM User dengan akses S3
  5. Catat Access Key dan Secret Key

Opsi C: DigitalOcean Spaces

  1. Buka cloud.digitalocean.com
  2. Masuk to Spaces
  3. Klik Create Spaces
  4. Catat Endpoint, Access Key, dan Secret Key

Langkah 2: Connect ke Helipod

  1. Buka project Helipod
  2. Masuk ke Settings → Integrations
  3. Cari Object Storage (S3) dan klik Connect
  4. Isi konfigurasi:
S3_ENDPOINT=https://xxx.r2.cloudflarestorage.com
S3_BUCKET=helipod-uploads
S3_ACCESS_KEY=your-access-key
S3_SECRET_KEY=your-secret-key

Langkah 3: Test Upload

Buka Storage Playground di Helipod:

  1. Masuk ke Project → Object Storage
  2. Upload test file
  3. Copy URL file yang di-upload

Jika berhasil, integrasi sudah siap!

Fitur Unggulan

File Browser

┌─────────────────────────────────────────┐
│ Bucket: helipod-uploads                 │
├─────────────────────────────────────────┤
│ 📁 uploads/                             │
│   ├── 📁 users/                         │
│   │   ├── 🖼️ user-123-avatar.jpg (2MB) │
│   │   └── 🖼️ user-456-photo.png (5MB)  │
│   └── 📁 documents/                     │
│       └── 📄 contract-789.pdf (10MB)    │
│ 📁 backups/                             │
│   └── 📦 backup-2026-06-17.tar.gz       │
├─────────────────────────────────────────┤
│ Storage: 2.3GB / Unlimited              │
│ Files: 1,234                            │
└─────────────────────────────────────────┘
  • Visual browser — Lihat semua files dan folders
  • Upload drag-and-drop — Upload file dengan mudah
  • Preview — Lihat gambar dan documents
  • Download — Download files langsung

URL Management

File: uploads/users/user-123-avatar.jpg

Public URL:
https://helipod-uploads.r2.dev/uploads/users/user-123-avatar.jpg

Signed URL (expiring):
https://helipod-uploads.r2.dev/uploads/users/user-123-avatar.jpg?X-Amz-...
  • Public URLs — Untuk files yang public
  • Signed URLs — Untuk files yang perlu auth
  • Custom domains — Domain sendiri untuk URLs

Usage Analytics

Di Helipod dashboard, kamu bisa lihat:

  • Storage usage — Total storage terpakai
  • Bandwidth — Total bandwidth terpakai
  • File count — Jumlah files
  • Cost estimate — Estimasi cost bulanan

Use Cases

1. User Avatar Upload

import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';

const s3 = new S3Client({
  endpoint: process.env.S3_ENDPOINT,
  region: 'auto',
  credentials: {
    accessKeyId: process.env.S3_ACCESS_KEY,
    secretAccessKey: process.env.S3_SECRET_KEY,
  },
});

async function uploadAvatar(userId, file) {
  const key = `users/${userId}/avatar-${Date.now()}.jpg`;
  
  await s3.send(new PutObjectCommand({
    Bucket: process.env.S3_BUCKET,
    Key: key,
    Body: file.buffer,
    ContentType: file.mimetype,
  }));
  
  return `https://${process.env.S3_BUCKET}.r2.dev/${key}`;
}

2. Document Storage

async function uploadDocument(userId, document) {
  const key = `documents/${userId}/${document.name}`;
  
  await s3.send(new PutObjectCommand({
    Bucket: process.env.S3_BUCKET,
    Key: key,
    Body: document.buffer,
    ContentType: document.mimetype,
    Metadata: {
      'user-id': userId,
      'upload-date': new Date().toISOString(),
    },
  }));
  
  return { key, url: `https://${process.env.S3_BUCKET}.r2.dev/${key}` };
}

3. Backup Storage

import { exec } from 'child_process';
import { promisify } from 'util';

const execAsync = promisify(exec);

async function backupDatabase() {
  // Dump database
  await execAsync('pg_dump mydb > backup.sql');
  
  // Upload ke S3
  const key = `backups/db-${Date.now()}.sql`;
  const backup = fs.readFileSync('backup.sql');
  
  await s3.send(new PutObjectCommand({
    Bucket: process.env.S3_BUCKET,
    Key: key,
    Body: backup,
  }));
  
  console.log(`Backup uploaded: ${key}`);
}

4. Static Asset Hosting

// Serve static assets dari S3
const assets = {
  logo: 'https://helipod-uploads.r2.dev/assets/logo.png',
  favicon: 'https://helipod-uploads.r2.dev/assets/favicon.ico',
  css: 'https://helipod-uploads.r2.dev/assets/styles.css',
};

Best Practices

1. Organize Files dengan Folders

bucket/
├── users/
│   └── {user-id}/
│       ├── avatar.jpg
│       └── profile/
├── documents/
│   └── {user-id}/
│       └── {document-id}.pdf
├── uploads/
│   └── {date}/
│       └── {filename}
└── backups/
    └── {date}/
        └── backup.tar.gz

2. Gunakan Content-Type yang Benar

// Set content-type untuk setiap file
const contentTypes = {
  '.jpg': 'image/jpeg',
  '.png': 'image/png',
  '.pdf': 'application/pdf',
  '.mp4': 'video/mp4',
};

await s3.send(new PutObjectCommand({
  Bucket: process.env.S3_BUCKET,
  Key: key,
  Body: file.buffer,
  ContentType: contentTypes[ext] || 'application/octet-stream',
}));

3. Implementasi CDN

// Cloudflare R2 sudah include CDN
// URL langsung cepat dari edge locations
const fileUrl = `https://${bucket}.r2.dev/${key}`;

4. Set Lifecycle Rules

Di Cloudflare R2:
- Files di /temp/ → Auto-delete setelah 7 hari
- Files di /backups/ → Keep selamanya
- Files di /uploads/ → Keep selamanya

FAQ

Berapa biaya S3-compatible storage?

Cloudflare R2 (Recommended):

  • Storage: $0.015/GB/bulan
  • Bandwidth: GRATIS
  • Free tier: 10GB

AWS S3:

  • Storage: $0.023/GB/bulan
  • Bandwidth: $0.09/GB
  • Free tier: 5GB/12 bulan

Bagaimana cara migrasi dari provider lain?

Kamu bisa menggunakan tools seperti rclone atau aws s3 sync untuk migrasi:

# Migrasi dari S3 ke R2
rclone sync s3:old-bucket s3:new-bucket \
  --s3-endpoint=https://xxx.r2.cloudflarestorage.com

Apakah ada batasan file size?

Bergantung pada provider:

  • Cloudflare R2: Max 5TB per object
  • AWS S3: Max 5TB per object

Bagaimana keamanan files?

  • Gunakan signed URLs untuk files privat
  • Set bucket policies untuk akses
  • Enable versioning untuk backup
  • Gunakan encryption untuk data sensitif

Checklist Setup

  • Pilih provider (R2/S3/DO Spaces)
  • Buat bucket
  • Buat access keys
  • Connect ke Helipod
  • Test upload
  • Setup folder structure
  • Implementasi CDN
  • Monitor usage

Kesimpulan

Object storage dengan S3-compatible + Helipod adalah solusi untuk file storage yang scalable, reliable, dan cost-effective. Kamu bisa:

  • ✅ Upload files dari dashboard
  • ✅ Generate public/signed URLs
  • ✅ Gunakan CDN built-in
  • ✅ Bayar sesuai pemakaian
  • ✅ Scale tanpa batas

Butuh bantuan setup? Hubungi [email protected]

Baca juga:

Siap coba Helipod?

Deploy aplikasi kamu sekarang. Gratis, tanpa kartu kredit.

Mulai Gratis →