# Is this possible? Migrate existing data storage to S3

**URL:** <https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819>\
**Category:** ℹ️ Support\
**Tags:** external\_storage, aws, nc12, s3\
**Created:** [December 16, 2017, 2:51pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819 "2017-12-16T14:51:58Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![lesaff](https://help.nextcloud.com/user_avatar/help.nextcloud.com/lesaff/32/2853_2.png) [@lesaff](https://help.nextcloud.com/u/lesaff)\
**Post date:** [December 16, 2017, 2:51pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/1 "2017-12-16T14:51:59Z")

</div>

Hi, I currently have a Nextcloud 12.0.4 using regular filesystem as my primary storage. I would like to migrate all files on existing primary storage to AWS S3.

Is there a way to do this on an existing installation?

Thanks  
Rudy

---

<div class="post-metadata">

**Author:** ![Dan\_Smith](https://help.nextcloud.com/letter_avatar/dan_smith/32/6_449c533f586939b6e5f246632a46421f.png) [@Dan\_Smith](https://help.nextcloud.com/u/Dan_Smith)\
**Post date:** [January 7, 2018, 3:47am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/2 "2018-01-07T03:47:43Z")

</div>

no, been there and tried that. you can only use AWS S3 by:

1. install nextcloud
2. go to setup page but don’t enter anything (even admin user email)
3. edit config/config.php to put the S3 details in

```auto
 array (
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' => 
    array (
      'bucket' => '<BUCKET NAME>',
      'autocreate' => true,
      'key' => '<KEY>',
      'region' => '<REGION - IF REQUIRED>',
      'secret' => '<SECRET>',
      'use_ssl' => true,
      'use_path_style' => false,
    ),
```

1. now refresh the setup page and go from there.

---

<div class="post-metadata">

**Author:** ![ibr](https://help.nextcloud.com/letter_avatar/ibr/32/6_449c533f586939b6e5f246632a46421f.png) [@ibr](https://help.nextcloud.com/u/ibr)\
**Post date:** [January 16, 2018, 8:01am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/3 "2018-01-16T08:01:50Z")

</div>

Hi,

> go to setup page but don’t enter anything (even admin user email)

you mean by that not even access the NextCloud server from the browser, or I can access the server from the browser but not to do anything there? because I want to try your solution on a different server and I don’t want to mess up anything and re install, and I shouldn’t also create admin user as well?

another question, this part I intend to add to the config.php, is it OK?

```
'objectstore' =>
  array(
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' => array(
            'bucket' => 'nextcloud',
	    'autocreate' => true,
	    'key' => 'XXXXXX',
	    'secret' => 'xxxxxxxxxxxxxxxxx',
	    'hostname' => 's3-us-east-1.amazonaws.com',
	    'use_ssl' => false,
	    'region' => 'us-east-1',
	  ),
  ),

```

keep in mind I made the argument `'use_ssl'` to false since I’m don’t have certificate and I’m using http for testing, is that OK too?

Thanks

---

<div class="post-metadata">

**Author:** ![Dan\_Smith](https://help.nextcloud.com/letter_avatar/dan_smith/32/6_449c533f586939b6e5f246632a46421f.png) [@Dan\_Smith](https://help.nextcloud.com/u/Dan_Smith)\
**Post date:** [January 16, 2018, 10:03am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/4 "2018-01-16T10:03:21Z")

</div>

Think your config looks ok.

When you install nextcloud it installs the files to the correct path but the first time you launch the setup screen it creates the initial config file with the instance id. That’s the point when you need to edit it to enter the bucket details.

If you enter any information on the setup screen, even admin user id, I’ve found it goes a little further in the setup process and then it won’t work with S3. So in essence, open a browser window to the setup screen and leave it there until you’ve entered the bucket details and then go back to it to continue.

---

<div class="post-metadata">

**Author:** ![ibr](https://help.nextcloud.com/letter_avatar/ibr/32/6_449c533f586939b6e5f246632a46421f.png) [@ibr](https://help.nextcloud.com/u/ibr)\
**Post date:** [January 16, 2018, 10:13am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/5 "2018-01-16T10:13:44Z")

</div>

thanks,

one question before i try it, you wrote `class’ => ‘OC\Files\ObjectStore\S3`

yet in the [link](https://docs.nextcloud.com/server/11/admin_manual/configuration_files/primary_storage.html#amazon-s3)

its `'class' => 'OC\\Files\\ObjectStore\\S3'` ,here its double “\”, and its the same in the config.php, classes names are with “\” so which one to use?  
thanks

---

<div class="post-metadata">

**Author:** ![Dan\_Smith](https://help.nextcloud.com/letter_avatar/dan_smith/32/6_449c533f586939b6e5f246632a46421f.png) [@Dan\_Smith](https://help.nextcloud.com/u/Dan_Smith)\
**Post date:** [January 16, 2018, 10:17am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/6 "2018-01-16T10:17:21Z")

</div>

sorry, missed that. I just rechecked my config and you’re right it does have the double slashes - not too sure why when I copied it over it came out 🤔

EDIT - my fault, when I put my original post I forgot to put the code tags around it so it took the second slash to be an escape character and just shows one - edited that original one now and it shows correctly! 😊

---

<div class="post-metadata">

**Author:** ![ibr](https://help.nextcloud.com/letter_avatar/ibr/32/6_449c533f586939b6e5f246632a46421f.png) [@ibr](https://help.nextcloud.com/u/ibr)\
**Post date:** [January 16, 2018, 11:16am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/7 "2018-01-16T11:16:58Z")

</div>

sorry for the bother,

I added the exact:

```
  'objectstore' => array(
        'class' => 'OC\\Files\\ObjectStore\\S3',
        'arguments' => array(
                'bucket' => 'nextcloud',
                'autocreate' => true,
                'key' => 'XXXXXXXXXXXX',
                'secret' => 'xxxxxxxxxxxxxxxxxx',               
                'use_ssl' => true,
                'region' => 'us-east-1',
		    ‘use_path_style’ => false,
        ),
  ),

```

before even creating the admin user, then after I did that, reset the apache `sudo service apache2 restart` then refreshed the page, and continued.

now it was obvious server didn’t take the S3 bucket since the bucket is empty, but the weird thing, when I opened the config.php again, I didn’t find S3 configuration anywhere (the part that I have added). could it be overwritten, or I just forgot to save? have you faced something like this?

thanks

---

<div class="post-metadata">

**Author:** ![ibr](https://help.nextcloud.com/letter_avatar/ibr/32/6_449c533f586939b6e5f246632a46421f.png) [@ibr](https://help.nextcloud.com/u/ibr)\
**Post date:** [January 16, 2018, 3:34pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/8 "2018-01-16T15:34:09Z")

</div>

the Amazon S3 part was deleted maybe because I restarted the apache, or maybe I just forgot to save, anyways I tried again with the same Amazon S3 configuration and refreshed the page, the configuration is there and wasn’t deleted , and I can create users and sync files but when I look what inside the S3 bucket through cloudberry I found file like `urn:oid:1149`

is that how NextCloud stores files in S3?

---

<div class="post-metadata">

**Author:** ![Dan\_Smith](https://help.nextcloud.com/letter_avatar/dan_smith/32/6_449c533f586939b6e5f246632a46421f.png) [@Dan\_Smith](https://help.nextcloud.com/u/Dan_Smith)\
**Post date:** [January 16, 2018, 3:47pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/9 "2018-01-16T15:47:26Z")

</div>

yep, that’s right. if you look in the nextcloud ui you should be able to upload/download docs correctly.

---

<div class="post-metadata">

**Author:** ![couling](https://help.nextcloud.com/letter_avatar/couling/32/6_449c533f586939b6e5f246632a46421f.png) [@couling](https://help.nextcloud.com/u/couling)\
**Post date:** [June 7, 2018, 9:11pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/10 "2018-06-07T21:11:45Z")

</div>

I just wanted to drop a note to say that I have managed to migrate my instance to S3 from local storage, but it took some fairly mega changes to the file structure to achieve.

If your feeling brave (or stupid) I’ve written up my method here:

[https://pedal.me.uk/migrating-a-nextcloud-instance-to-amazon-s3/](https://pedal.me.uk/migrating-a-nextcloud-instance-to-amazon-s3/)

---

<div class="post-metadata">

**Author:** ![Reiner\_Nippes](https://help.nextcloud.com/user_avatar/help.nextcloud.com/reiner_nippes/32/9479_2.png) [@Reiner\_Nippes](https://help.nextcloud.com/u/Reiner_Nippes)\
**Post date:** [June 8, 2018, 2:36pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/12 "2018-06-08T14:36:50Z")

</div>

Another way: -\> [https://bitbucket.org/nikratio/s3ql/](https://bitbucket.org/nikratio/s3ql/)  
Mount S3 as a local fs before the setup of NextCloud.

---

<div class="post-metadata">

**Author:** ![lesaff](https://help.nextcloud.com/user_avatar/help.nextcloud.com/lesaff/32/2853_2.png) [@lesaff](https://help.nextcloud.com/u/lesaff)\
**Post date:** [June 8, 2018, 3:47pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/13 "2018-06-08T15:47:05Z")

</div>

I am currently away on vacation from June 1 to June 8, back on June 11. If you require immediate attention, please contact [techsupport@adnetinc.com](mailto:techsupport@adnetinc.com) or [updates@adnetinc.com](mailto:updates@adnetinc.com)

Regards

Rudy

---

<div class="post-metadata">

**Author:** ![flyinghuman](https://help.nextcloud.com/letter_avatar/flyinghuman/32/6_449c533f586939b6e5f246632a46421f.png) [@flyinghuman](https://help.nextcloud.com/u/flyinghuman)\
**Post date:** [September 26, 2018, 8:04am UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/14 "2018-09-26T08:04:49Z")

</div>

Hi couling, your Server seems to be offline. Can you please check? I found your method earlier and now i can need it 🙂 thanks!

---

<div class="post-metadata">

**Author:** ![couling](https://help.nextcloud.com/letter_avatar/couling/32/6_449c533f586939b6e5f246632a46421f.png) [@couling](https://help.nextcloud.com/u/couling)\
**Post date:** [October 4, 2018, 1:50pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/15 "2018-10-04T13:50:26Z")

</div>

Yeah. Mysql crashed the day I left for vacation. It should be back up now but may go down again until I can access AWS.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 2, 2024, 3:38pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/16 "2024-12-02T15:38:31Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 1:42pm UTC](https://help.nextcloud.com/t/is-this-possible-migrate-existing-data-storage-to-s3/24819/17 "2024-12-09T13:42:00Z")

</div>


