Installing Nextcloud on AWS EC2 with S3 Storage

December 07, 2019

2019 12 08

In an effort to enhance my privacy, I've decided to minimize the use of Google products. I've replaced Chrome with Firefox, switched from Gmail to ProtonMail, and am now using Nextcloud instead of Google Drive. Nextcloud allows for self-hosting of cloud storage and provides control over my own data. Below are the steps to install Nextcloud on AWS EC2 and configure it to use S3 storage.

40e01 0vtolobxit5uqf74

  1. Install Nextcloud using the Snap package manager:

    sudo snap install nextcloud
  2. Create an admin user account:

    sudo nextcloud.manual-install <admin_username> <admin_password>
  3. Add your trusted domain:

    sudo nextcloud.occ config:system:set trusted_domains 1 --value=<your-domain>
  4. Using AWS Route 53, create an A record that points to the IP address of your Nextcloud server.

  5. Set up an SSL certificate with Let's Encrypt:

    sudo nextcloud.enable-https lets-encrypt

1e3b0 0pgy6vjiagq31qwdr

  1. Navigate to your domain, and you should now be able to log in to your Nextcloud instance.

b4390 0yfzy f0q7rap8l4c 6b8a8 0 w7ugojnsxat24b0

  1. Click on "Apps" and enable "Default encryption module" and "External storage support."

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

  3. Create a new policy using the JSON code below, replacing NAMEOFYOURBUCKET with the name of your S3 bucket. Attach this policy to the newly created user.

8482f 0spcfdpt3qgs x5zy

    "Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
            "Action": [
            "Resource": "arn:aws:s3:::*"
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
  1. In Nextcloud settings, select "External Storage." Fill in the "Bucket" field with NAMEOFYOURBUCKET. Check "Enable SSL" and "Enable Path Style," then fill in the required information using the credentials of the user you created.

  2. You're done! Navigate to your d3 folder, and you should now be able to upload files.

15950 0nece4bfydfgvdd3

Profile picture

Victor Leung, who blog about business, technology and personal development. Happy to connect on LinkedIn