Skip to main content

Amazon S3 and S3-compatible storages

Amazon S3 or S3-compatible connects Amazon S3 itself, and any storage that speaks its API: Backblaze B2, Wasabi, DigitalOcean Spaces, Scaleway, a MinIO server of your own and many others. How storages work, and where each kind of file goes, is on Storage.

1. Make a bucket​

In the S3 console, go to General purpose buckets and press Create bucket. Give it a name and a region, such as eu-central-1, and keep Block all public access on: your site signs a link for each view. The name and the region can't change later.

At another provider, make a bucket the same way and note its endpoint.

2. Make a key for the bucket alone​

Make a key that can read, write, delete and list the files of this bucket, and nothing else. In AWS:

  1. In IAM, make a user for your site, such as riverside-uploads.

  2. Give it a policy for the bucket, with your bucket name in place of riverside-uploads:

    {
    "Version": "2012-10-17",
    "Statement": [
    { "Effect": "Allow", "Action": ["s3:ListBucket", "s3:GetBucketCors", "s3:PutBucketCors"], "Resource": "arn:aws:s3:::riverside-uploads" },
    { "Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"], "Resource": "arn:aws:s3:::riverside-uploads/*" }
    ]
    }
  3. Under the Security credentials of the user, press Create access key, and copy the Access key ID and the Secret access key. AWS shows the secret only once.

3. Connect it​

  1. In WordPress, go to Poly Community → Settings → Services → Storage and choose Amazon S3 or S3-compatible.
  2. Press Connect. Leave Endpoint empty for Amazon S3, or enter the one your provider gives you.
  3. Fill in the Region, the Bucket, the Access key ID and the Secret access key.
  4. Under Who can open files, keep Only people allowed to see the file.
  5. Press Test connection, then Save.
Connecting Amazon S3: Endpoint empty, Region eu-central-1, Bucket, Access key ID, Secret access key and Folder
Settings → Services → Storage, Amazon S3

Then choose what goes there under Where files go, as Storage says. With the policy above, Configure CORS adds the rule for uploads from the browser.

Other providers​

Each provider gives an endpoint for its region, such as s3.eu-central-003.backblazeb2.com for Backblaze B2, fra1.digitaloceanspaces.com for DigitalOcean Spaces or s3.eu-central-1.wasabisys.com for Wasabi. A MinIO server of your own needs Path-style URLs on. A provider that makes files public one by one, such as DigitalOcean Spaces, offers Upload each file as public-read for public files.

Public files​

If you choose Anyone with the link instead, enter the Public URL files are served from: the public address of the bucket, or a CDN in front of it. The bucket then has to let anyone read its files.