How to add Pilvio S3 as primary storage for Nextcloud

In our previous article, we break down how to connect Pilvio S3 as additional external storage for your nextcloud installation.

But can we use S3 as primary storage for Nextcloud?
The answer is yes.


Since after you switch your Nextcloud to s3, earlier uploaded files will become not accessible (It’s possible to switch primary storage back though).

See more details in Nextcloud official documentation.

Step 1: Let’s navigate our Nextcloud installation directory.
We are interested in Nextcloud config file.
For this particular example, the configuration file is located in “/var/www/nextcloud/config”.

Step 2: Let’s add S3 access details into config.php:

If you want Nextcloud to create bucket for you, then set: ‘autocreate’ => true.

Keep in mind that the bucket name should be unique within the entire S3 storage, so please use something more complicated than “nextcloud” or “test”.

Example of S3 storage configurations part:

'objectstore' => [
          'class' => '\\OC\\Files\\ObjectStore\\S3',
          'arguments' => [
                 'bucket' => 'nextcloud-primary',
                 'autocreate' => true,
                 'key' => '1HMGRV02GZABY13QNKJE',
                 'secret' => 'M5MrXTRjkyMaxXPe2FRXMTfTfbKEnZCu+7uRTVSj',
                 'hostname' => '',
                 'use_ssl' => true

The whole config may look like this:

Step 3:
Refresh Nextcloud page in your browser.

Go to Files tab

Let’s now upload some files

Test video smoothly playing.

Let’s use an external tool and check the content of our s3 bucket.
As we see, Nextcloud is using its own format for storing files.
Let’s try to compare file sizes to determine where is the representation of our three test videos.

We can easily find our 3 video files:

It means that our primary Nextcloud storage on Pilvio S3 is working.

Share on facebook
Share on linkedin
Share on twitter
Share on pinterest
Share on email

Related News