Install Nextcloud on AWS EC2 and using S3 storage

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

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

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.

"Version": "2012-10-17",
"Statement": [
"Effect": "Allow",
"Action": [
"Resource": "arn:aws:s3:::*"
"Effect": "Allow",
"Action": "s3:*",
"Resource": [

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.

Originally published at on December 7, 2019.

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: