Laravel, Object Storage, S3 and MinIO Free Object Storage

Mohammad Roshandelpoor
4 min readJun 10, 2024

--

Object storage has emerged as a pivotal technology, offering scalability, durability, and cost-effectiveness. This article delves into the concept of object storage, with a focus on two prominent services: Amazon S3 and MinIO. We will explore their features, compare them, and discuss their use cases to help you decide which might be the best fit for your needs.

What is Object Storage?

Object storage organizes data into discrete units called objects. Each object contains the data itself, a variable amount of metadata, and a unique identifier. This design allows for highly scalable storage systems where objects can be stored across various devices and locations.

Comparison with Block Storage and File Storage

  • Block Storage: Divides data into fixed-size blocks, and each block has an address but lacks metadata. Suitable for high-performance applications such as databases and virtual machines.
  • File Storage: Organizes data in a hierarchical structure of files and directories. Commonly used for NAS systems and is ideal for file sharing and management.
  • Object Storage: Stores data as objects, each with its metadata, making it highly scalable and suitable for unstructured data such as multimedia files, backups, and big data analytics.

Features of S3

Amazon S3 (Simple Storage Service) is a widely used object storage service known for its robustness and scalability.

  • Scalability: Amazon S3 is designed to handle virtually unlimited amounts of data, allowing businesses to scale their storage needs effortlessly as they grow.
  • Durability: S3 promises 99.99% (11 9’s) of durability, ensuring that the data stored is highly protected against data loss.
  • Security: S3 offers robust security features, including data encryption at rest and in transit, fine-grained access controls, and integration with AWS Identity and Access Management (IAM).
  • Pricing: Amazon S3’s pricing model is pay-as-you-go, with costs based on the amount of data stored, the number of requests made, and data transfer volumes. This can be cost-effective for large-scale applications but may become expensive for smaller projects or unpredictable workloads.

Features of MinIO

MinIO is an open-source object storage server designed for high performance and compatibility with S3.

  • Open-source: MinIO is open-source, making it accessible for businesses looking to avoid vendor lock-in and have more control over their storage infrastructure.
  • High Performance: MinIO is optimized for high performance, capable of handling large data workloads with low latency, making it ideal for high-speed data processing applications.
  • Compatibility with S3: MinIO is designed to be compatible with the S3 API, allowing applications designed for S3 to easily switch to MinIO without significant code changes.

Comparison of S3 and MinIO

Both S3 and MinIO offer robust object storage solutions, but their features cater to different needs:

  • S3: Offers extensive integration with other AWS services, higher durability, and comprehensive security features.
  • MinIO: Provides more flexibility through open-source access, high performance, and seamless S3 compatibility.

S3 is designed to handle massive workloads and integrates well with other AWS services for large-scale cloud applications. MinIO, on the other hand, offers superior performance in environments where high-speed data access is critical, such as AI and machine learning workloads.

Laravel and MinIO

Integrating Laravel with MinIO S3 can significantly enhance your application’s storage capabilities by providing a scalable and efficient solution. To get started, configure your .env file with the necessary MinIO settings, such as MINIO_ENDPOINT, MINIO_ACCESS_KEY, and MINIO_SECRET_KEY. Next, update the config/filesystems.php file to include a new disk configuration for MinIO. Here's a sample code snippet:

'minio' => [
'driver' => 's3',
'endpoint' => env('MINIO_ENDPOINT'),
'key' => env('MINIO_ACCESS_KEY'),
'secret' => env('MINIO_SECRET_KEY'),
'region' => 'us-east-1',
'bucket' => env('MINIO_BUCKET'),
'use_path_style_endpoint' => true,
],

To test uploading a file to MinIO using Laravel, you can use the following command in your project:

// save
Storage::disk('minio')->put( "test.txt" , "Its working ..." );

// get
$file = Storage::disk('minio')->get( "test.txt" );

The file “test.txt” has been successfully uploaded to your MinIO bucket. You can then verify the upload by checking the MinIO console or by retrieving the file using the appropriate methods.

MinIO console And Check Buckets

The MinIO Console is a rich graphical user interface that provides an overview of the MinIO Server and describes configuration options and instructions for logging in.

Conclusion

Object storage is a cornerstone of modern IT infrastructure, providing scalable and durable storage solutions for unstructured data. Amazon S3 and MinIO each offer distinct advantages. Choosing between S3 and MinIO depends on your specific requirements, including performance needs, budget constraints, and integration preferences.

Feel free to Subscribe for more content like this 🔔, clap 👏🏻 , comment 💬, and share the article with anyone you’d like

And as it always has been, I appreciate your support, and thanks for reading.

--

--

Mohammad Roshandelpoor

Software Engineer | Laravel | PHP | Nuxt | Vue | with over 10 years of experience, have a deep understanding of software architecture