Create New Document

The title of your document (will be displayed as H1)
URL-friendly name (no spaces, use dashes)
Path where to create document (optional, use forward slashes to create subdirectories)

Move/Rename Document

Current location of the document
New path for the document (including the slug)
This only changes the document's path. It does not modify the document's title (H1 heading).

Delete Document

Are you sure you want to delete this document? This action cannot be undone.

Warning: If this is a folder, all contents including subfolders and documents will be deleted.

Message

Message content goes here.

Confirm Action

Are you sure?

Attachments

Allowed file types: jpg, jpeg, png, gif, svg, webp, txt, log, csv, sfd, zip, pdf, docx, xlsx, pptx, mp4 (Max: 10MB)

Document Files

Loading attached files...

Document History

Previous Versions

Loading versions...

Preview

Select a version to preview

Wiki Settings

Language for the user interface
Number of versions to keep per document. Set to 0 to disable versioning.
Maximum allowed file size for uploads in MB.

User Management

Add New User

Leave empty to keep current password
Users with these groups can access restricted sections.

Define path-based access rules for sections of your wiki, then assign users to groups in the Users tab. Rules are evaluated in order. First match wins.

Active Rules

Import markdown files from a ZIP archive. Files will be processed and stored in the appropriate document structure. Directory structure in the ZIP (category/subcategory) will be preserved in the wiki.

Upload a ZIP file containing markdown (.md) files to import.

Create and manage backups of your wiki data. Backups include all documents, images, and configuration files.

Available Backups

Loading backups...

Add/Edit Access Rule

Selected: /

Add Column

Nextcloud S3 Architecture Analysis

Design Choices, Trade-offs, and Cost Implications

Date: October 27, 2025
Context: 30 users, 100 TB storage, AWS eu-south-1 (Milan)


Executive Summary

RECOMMENDED ARCHITECTURE: S3 Primary Storage with S3 Versioning + Object Lock on replica bucket

Key Benefits:

Monthly Cost: €1,786-1,836 (47% savings vs. original design)


Nextcloud S3 Architecture Options

How it works:

S3 bucket structure:

s3://nextcloud-primary-bucket/
├── urn:oid:1234567890abcdef...  (user1's photo.jpg)
├── urn:oid:fedcba0987654321...  (user2's document.pdf)
├── urn:oid:abcd1234efgh5678...  (user3's video.mp4)
└── ...

Advantages:
✅ Better performance (metadata in database, not S3 prefixes)
✅ Fewer S3 API requests (no directory listings, direct object access by UUID)
✅ Efficient multipart upload with Redis/Memcached (streaming chunks directly to S3)
✅ No filesystem overhead on EC2 instance
Native S3 versioning works perfectly (each file = 1 S3 object with version history)
Object Lock can protect entire dataset from ransomware/deletion

Disadvantages:
❌ Files not accessible outside Nextcloud (UUID-based naming)
❌ Cannot browse S3 bucket manually to find specific files
❌ Requires database backup to be tightly synchronized with S3 (metadata coupling)
❌ Migration/disaster recovery requires both database + S3 restore

Cost implications:


Option 2: S3 as External Storage

How it works:

S3 bucket structure:

s3://nextcloud-external-bucket/
├── user1/
│   ├── Documents/
│   │   ├── file.pdf
│   │   └── report.docx
│   └── Photos/
│       └── vacation.jpg
├── user2/
│   └── ...

Advantages:
✅ Files accessible outside Nextcloud (standard file paths)
✅ Can browse/manage files using AWS Console, CLI, or other S3 tools
✅ Easier migration from traditional filesystems
✅ Can mount same bucket in multiple Nextcloud instances (read-only scenarios)

Disadvantages:
❌ Slower performance (metadata partially in S3, requires LIST operations)
❌ Higher S3 API costs (directory traversal, prefix listings)
❌ Chunked upload overhead (files assembled on EC2 before final upload)
S3 versioning is problematic (versioning entire directory structure is complex)
Object Lock is harder to implement (mixed file/folder structure)
❌ More EC2 disk space needed for temporary file assembly

Cost implications:


S3 Versioning + Object Lock: Design Choices

Why S3 Versioning is the Right Choice for Primary Storage

Problem: Nextcloud users need protection against:

  1. Accidental file deletion
  2. File overwrites (saving bad version over good version)
  3. Ransomware attacks (mass file encryption/deletion)
  4. Insider threats (malicious deletion)

Solution: S3 Versioning at the object level

How it works with Primary Storage:

Recovery process:

  1. User: "I deleted my file yesterday!"
  2. Admin restores database to timestamp before deletion (PITR)
  3. Admin restores S3 object version from before deletion
  4. File reappears in Nextcloud with all metadata intact

Cost: €22/month (assumes 2% file churn = 2TB versioned data at €11/TB for One Zone-IA)


Why Object Lock is Essential for Ransomware Protection

Problem: What if ransomware compromises Nextcloud application AND has AWS credentials?

Without Object Lock:

With Object Lock (GOVERNANCE mode):

Protection layers:

  1. Versioning (source bucket): Protects against accidental deletion/overwrite
  2. IAM restrictions: Application cannot delete object versions
  3. Cross-region replication: Geographic separation
  4. Object Lock (replica bucket): Immutable protection for 90 days

Cost: €94/month (100TB in Glacier Deep Archive at €0.00094/GB/month)


Design Trade-offs Analysis

Primary Storage vs. External Storage

Factor Primary Storage External Storage
Performance ⭐⭐⭐⭐⭐ Fast ⭐⭐⭐ Moderate
S3 API Cost €50-100/month €150-250/month
Versioning Support ⭐⭐⭐⭐⭐ Excellent ⭐⭐ Poor
Object Lock Support ⭐⭐⭐⭐⭐ Excellent ⭐⭐ Difficult
File Accessibility ❌ Nextcloud only ✅ Direct S3 access
Database Coupling ❌ Tight coupling ✅ Loose coupling
Migration Complexity ❌ High ✅ Low
EC2 Disk Usage ✅ Minimal ❌ High (chunking)

Winner: Primary Storage for cost, performance, and data protection


Versioning Strategy: Source vs. Replica

Option A: Versioning on Source Bucket Only

Option B: Versioning on Replica Bucket Only

Option C: Versioning on BOTH Buckets (RECOMMENDED)


Object Lock Mode: GOVERNANCE vs. COMPLIANCE

GOVERNANCE mode (RECOMMENDED):

COMPLIANCE mode:

Winner: GOVERNANCE mode provides adequate protection with operational flexibility


Performance Impact Analysis

API Request Patterns

Primary Storage with Versioning:

User uploads 10 MB file:
- 1x PutObject (€0.000005)
- 1x CopyObject for versioning (€0.000005)
Total: 2 API requests

User deletes file:
- 1x DELETE (adds delete marker) (€0.000005)
Total: 1 API request

User downloads file:
- 1x GetObject (€0.0000004)
Total: 1 API request

External Storage with Versioning:

User uploads 10 MB file:
- 5x ListBucket (directory traversal) (€0.000025)
- 1x PutObject (€0.000005)
- 1x CopyObject for versioning (€0.000005)
Total: 7 API requests (3.5x higher)

User deletes file:
- 3x ListBucket (€0.000015)
- 1x DELETE (€0.000005)
Total: 4 API requests (4x higher)

User downloads file:
- 2x ListBucket (€0.00001)
- 1x GetObject (€0.0000004)
Total: 3 API requests (3x higher)

Annual API cost difference: €840-1,200/year savings with Primary Storage


Latency Comparison

Primary Storage:

External Storage:

Performance impact: Primary Storage is 2-3x faster for typical operations


Cost-Benefit Analysis

Monthly Cost Breakdown (Primary Storage + Versioning + Object Lock)

Component Cost Benefit
S3 One Zone-IA (100TB) €1,100 Base storage
Noncurrent versions (2TB, 30 days) €22 Instant recovery (0-30 days)
Cross-region replication €50-100 Geographic redundancy
Replica Deep Archive (100TB) €94 Long-term immutable backup
Object Lock (included) €0 Ransomware protection
RDS backup (PITR + snapshots) €178 Database consistency
Total Data Protection €344-394 Multi-layer defense

Cost per TB per month: €3.44-3.94 for comprehensive protection
Industry benchmark: €5-10/TB/month for enterprise backup solutions
Savings: 50-65% vs. traditional backup solutions


Alternative 1: No Versioning + Nightly Snapshots

Approach: Use AWS Backup to snapshot entire bucket nightly

Alternative 2: Nextcloud Built-in Versioning

Approach: Let Nextcloud manage file versions (store multiple copies in S3)

Alternative 3: External Storage + EFS/FSx

Approach: Use AWS EFS or FSx for Lustre instead of S3


Recommendations

Storage Configuration:

Primary Storage: S3 One Zone-IA (eu-south-1)
├── Storage Class: One Zone-IA
├── Versioning: Enabled (30-day noncurrent retention)
├── Lifecycle: Expire noncurrent versions after 30 days
└── IAM: Allow read/write, DENY delete object versions

Replica Storage: S3 Glacier Deep Archive (eu-west-1)
├── Storage Class: Deep Archive
├── Versioning: Enabled
├── Object Lock: GOVERNANCE mode (90-day retention)
├── Replication: Enabled from primary bucket
└── IAM: DENY all application access

Database Configuration:

RDS PostgreSQL: Single-AZ db.m6i.large (eu-south-1)
├── Automated Backup: 30-day retention + PITR
├── AWS Backup: Cross-region snapshots every 6 hours (90-day retention)
└── Consistency: PITR ensures database matches S3 file state

Application Configuration:

Nextcloud config.php:
'objectstore' => [
  'class' => 'OC\\Files\\ObjectStore\\S3',
  'arguments' => [
    'bucket' => 'nextcloud-primary-bucket-eu-south-1',
    'key' => 'use-iam-role',
    'secret' => 'use-iam-role',
    'region' => 'eu-south-1',
    'use_ssl' => true,
    'use_path_style' => false,
  ],
],
'objectstore.multibucket' => false,  // Use single bucket for 30 users

Redis configuration (required for efficient multipart uploads):

'memcache.distributed' => '\\OC\\Memcache\\Redis',
'redis' => [
  'host' => 'localhost',
  'port' => 6379,
],

When to Consider Alternative Architectures

Use External Storage instead if:

Use EFS/FSx instead if:

Disable versioning if:


Implementation Checklist

Phase 1: Infrastructure Setup (Week 1)

Phase 2: Nextcloud Configuration (Week 2)

Phase 3: Testing & Validation (Week 3)

Phase 4: Monitoring Setup (Week 4)


Conclusion

Primary Storage + S3 Versioning + Object Lock is the optimal architecture because:

  1. Performance: 2-3x faster than External Storage (fewer API calls)
  2. Cost: 50-60% lower API costs (€50-100/month vs €150-250/month)
  3. Protection: Native S3 versioning + Object Lock provides comprehensive defense
  4. Recovery: Clean recovery process (restore by object version + database PITR)
  5. Scalability: Scales to petabytes without performance degradation

Total monthly cost: €1,786-1,836 (47% savings vs. original €3,325-3,419)

The combination of Primary Storage architecture with multi-layer versioning and Object Lock provides enterprise-grade data protection at consumer-grade pricing.


Document Version: 1.0
Author: AWS Cost Optimization Analysis
Date: October 27, 2025

Attached Files

Loading attached files...

Comments

No comments yet. Be the first to comment!

Search Results