Skip to content

S3 & Cloud Storage

Supported Providers

ProviderConfig KeyFeatures
AWS S3s3Backups, exports, file storage
Google Cloud StoragegcsBackups, exports
Azure Blob StorageazureBackups, exports
MinIOs3 (compatible)Self-hosted S3 alternative

AWS S3 Configuration

# nexusdb.yaml
storage:
  provider: s3
  bucket: my-nexusdb-backups
  region: eu-central-1
  prefix: production/
  credentials:
    access_key_id: ${AWS_ACCESS_KEY_ID}
    secret_access_key: ${AWS_SECRET_ACCESS_KEY}

Automated Backups to S3

nexusdb backup create \
  --destination s3://my-nexusdb-backups/daily/ \
  --compress zstd \
  --encrypt aes-256

File Attachments

Store binary files (images, PDFs, documents) in cloud storage:

const file = await db.files.upload({
  collection: "documents",
  documentId: "doc_abc123",
  field: "attachment",
  file: readableStream,
  contentType: "application/pdf",
  metadata: { originalName: "report.pdf" }
});

console.log(file.url);
// https://my-bucket.s3.amazonaws.com/documents/doc_abc123/report.pdf

Data Export

# Export a collection to S3 as JSON
nexusdb export \
  --collection orders \
  --format json \
  --destination s3://my-exports/orders-2024.json

# Export as CSV
nexusdb export \
  --collection orders \
  --format csv \
  --fields id,customer,total,status \
  --destination s3://my-exports/orders-2024.csv

MinIO (Self-Hosted)

storage:
  provider: s3
  endpoint: http://minio.internal:9000
  bucket: nexusdb-backups
  force_path_style: true
  credentials:
    access_key_id: minioadmin
    secret_access_key: minioadmin