Install Nextcloud on AWS EC2 and using S3 storage

December 07, 2019

I want more privacy, so I decided to minimize the use of Google products. I can replace Chrome with Firefox, replace Gmail with ProtonMail and replace Google Drive with Nextcloud. Nextcloud allows me to self-host of cloud storage and gives me control over my own data. Here are the steps to install it on AWS:


2. Install nextcloud with snap package manager

sudo snap install nextcloud

3. Create admin user account

sudo nextcloud.manual-install <admin_username> <admin_password>

4. Adding your trusted domain

sudo nextcloud.occ config:system:set trusted_domains 1 --value=<your-domain>

5. Using Route 53, create A record to the IP address of your nextcloud server

6. Setting up SSL certificate with let’s encrypt, enter your email and domain after:

sudo nextcloud.enable-https lets-encrypt

0  pGY6VJiagQ31qWdR

7. Go to the your domain and you can now login to your nextcloud:

0  YfZY  f0Q7RAP8l4C 0    w7UGojnsxaT24B0

8. Click on Apps and enable “Default encryption mode” and “External Storage Support mode”

9. Open IAM (Identity and Access Management) in AWS, create a new user with programmatic access.

10. Create new policy with JSON below, replace your NAMEOFYOURBUCKET with your s3 bucket name. Attached the policy to the new user created above.

0  sPcfdpT3QgS  X5Zy

{    "Version": "2012-10-17",    "Statement": [        {            "Effect": "Allow",            "Action": [                "s3:GetBucketLocation",                "s3:ListAllMyBuckets"            ],            "Resource": "arn:aws:s3:::*"        },        {            "Effect": "Allow",            "Action": "s3:*",            "Resource": [                "arn:aws:s3:::NAMEOFYOURBUCKET",                "arn:aws:s3:::NAMEOFYOURBUCKET*"            ]        }    ]}

11. Go to nextcloud setting and select External storage. Fill in the Bucket with NAMEOFYOURBUCKET, checked enable SSL, enable Path Style and fill in the information with credentials of your newly created user.

12. Done. Now go to your d3 folder, and you should be able to upload your file.

0  nece4BFydFgVdD3

Originally published at on December 7, 2019.

Written by Victor Leung who is a keen traveller to see every country in the world, passionate about cutting edge technologies. Follow me on Twitter