跪拜 Guibai
← All articles
Backend · Frontend

Swap Alibaba Cloud OSS for MinIO and Save Thousands a Year on Object Storage

By Yao806 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Managed object storage bills grow quietly with usage, and many small-to-medium projects never need the CDN, multi-AZ replication, or compliance features that justify the premium. Running MinIO on existing server disk turns a recurring line item into a fixed cost of zero, with an API that requires no code rewrites.

Summary

Small outsourcing projects can bleed money on managed object storage — one project with a few thousand contract scans hit 200 yuan a month on Alibaba Cloud OSS. Across three clients, that's several thousand yuan a year for disk space that already sits idle on the application server. MinIO, deployed as a single Docker container, drops into the same S3 API surface and eliminates the per-GB and per-request charges entirely. The setup uses two buckets — public for avatars and cover images, private for contracts and ID documents — with presigned URLs controlling access to sensitive files. Spring Boot integration requires one Maven dependency and a configuration class; a utility wrapper reduces upload, download, presigned-URL generation, and delete to one-liners in business code. Multipart upload with a 5 MB part size prevents out-of-memory crashes on large files, and an nginx proxy or the MINIO_SERVER_URL env var fixes the internal-IP problem in presigned links. The trade-offs are real: no built-in CDN, single-machine availability, and extra work if compliance demands audit logs or cross-region backup. For projects that don't hit those constraints, the cost goes to zero while the server's idle disk gets used.

Takeaways
MinIO is a drop-in S3-compatible replacement that runs in a single Docker container on your existing server.
Two buckets — public and private — combined with presigned URLs cover the most common access patterns without exposing sensitive files.
Multipart upload with a 5 MB part size avoids OOM errors when handling files tens of megabytes or larger.
Inside Docker, use the container service name (http://minio:9000) instead of localhost for the endpoint.
Presigned URLs contain the internal IP by default; fix this with an nginx proxy or the MINIO_SERVER_URL environment variable.
MinIO lacks built-in CDN, single-node HA, and compliance-grade audit logging — if those are required, managed OSS is still the better fit.
Conclusions

The cost argument flips once you realize the server already has idle disk: you're paying OSS for storage you've already provisioned and aren't using.

MinIO's S3 API compatibility means the migration is a config change, not a rewrite — the same code that talks to S3 talks to MinIO, which lowers the risk of switching.

The three disqualifiers — CDN, HA, compliance — draw a clean line: if your project doesn't need them, managed object storage is pure overhead.

Concepts & terms
Presigned URL
A time-limited, cryptographically signed URL that grants temporary access to a private object in object storage. The signature is generated server-side using the secret key, so the client never sees credentials.
Multipart upload
A technique that splits a large file into smaller parts and uploads them independently, then reassembles them on the server. It avoids loading the entire file into memory and allows resuming interrupted uploads.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗