Logo
← Back to blog

How to connect Scaleway Object Storage to file.rocks

Cover image

Scaleway Object Storage speaks the same API as Amazon S3, so file.rocks connects to it with the Other S3-compatible option. Your files stay in your Scaleway bucket, and file.rocks gives you a place to browse and upload them.

You'll set up two things at Scaleway first: an API key, and a CORS rule so uploads from your browser go through. The API key takes a few clicks in the Scaleway console. The CORS rule needs a terminal, and we'll go through it one command at a time.

1. Find your endpoint

Your endpoint is https://s3. followed by your bucket's region code and .scw.cloud. Scaleway has four:

  • https://s3.fr-par.scw.cloud
  • https://s3.nl-ams.scw.cloud
  • https://s3.pl-waw.scw.cloud
  • https://s3.it-mil.scw.cloud

Use the region your bucket is in. Paste only that address, without the bucket name in front of it.

2. Create an API key

In the Scaleway console, click IAM & API keys on the top-right drop-down menu. Click the API keys tab, then + Generate API key.

Select the bearer of the key: yourself as an IAM user, or an IAM application. Enter an optional description you'll recognize, like "file.rocks". Then enter the expiration: Never, a set period, or Custom with a date.

Scaleway then asks whether the key will be used for Object Storage. Choose Yes, set up preferred Project and pick the Project your bucket is in. This choice matters. Every Object Storage action made with this key goes to its preferred Project, so file.rocks will only reach buckets in that Project.

Click Generate API key. The next screen shows your access key and secret key, and it's your only chance to save the secret key. Copy both before you close it.

The key can do what your bearer's policies allow, and nothing more.

3. Allow uploads with CORS

When you upload in file.rocks, the file goes straight from your browser to your bucket. Your bucket has to allow that, and file.rocks doesn't set it up for you. Scaleway's CORS guide uses the AWS CLI, so we will too.

Set up the AWS CLI

Install the AWS CLI using Amazon's install guide. Then open a terminal. On a Mac that's the Terminal app, on Windows it's PowerShell, and on Linux it's whatever terminal you normally use.

Run this and paste your access key and secret key when it asks:

aws configure

For the region, type your region code, like fr-par. For the output format, type json.

Now open the config file it made. On Mac or Linux, run nano ~/.aws/config. On Windows, the file is .aws\config in your user folder.

Make it match this, with your own region in place of fr-par:

[default]
region = fr-par
output = json
services = scw-fr-par

[services scw-fr-par]
s3 =
  endpoint_url = https://s3.fr-par.scw.cloud
s3api =
  endpoint_url = https://s3.fr-par.scw.cloud

This is a short version of Scaleway's example. Their file adds settings for big multipart uploads, which you don't need here. The s3api lines matter, because the CORS commands below use them. Save the file. In nano, that's Ctrl + O, then Enter, then Ctrl + X.

Write the CORS rule

Make a file called file-rocks-cors.json with this in it:

{
  "CORSRules": [
    {
      "AllowedOrigins": ["https://www.file.rocks"],
      "AllowedMethods": ["PUT", "GET", "HEAD"],
      "AllowedHeaders": ["Content-Type"]
    }
  ]
}

Scaleway's own example allows more methods and any header. This rule only allows what file.rocks needs. PUT is the important one, because that's how your browser sends the file.

Apply it and check it

In the same folder as the file, run this, with your bucket's name in place of your-bucket:

aws s3api put-bucket-cors --bucket your-bucket --cors-configuration file://file-rocks-cors.json

If it worked, it prints nothing. That's normal. Now read the rule back:

aws s3api get-bucket-cors --bucket your-bucket

You should see your origin, the three methods, and Content-Type.

4. Open the bucket form

In file.rocks, go to Settings, then Buckets, and click Add Bucket. If you don't have any buckets yet, the button reads Create your first bucket.

The Create Bucket window opens. Under Storage Type, pick Bring Your Own. Then open Provider and choose Other S3-compatible.

5. Fill in the details

Access Key ID and Secret Access Key are the pair you made in step 2.

Endpoint is the address from step 1, starting with https://.

Bucket Name is the name of your bucket.

For Region, type your region code, like fr-par. That's how Scaleway's own docs fill in the region for S3 tools. If file.rocks puts in something different after you leave the Endpoint or Bucket Name box, change it back.

Nickname (optional) is the name you'll see in file.rocks, like "Scaleway fr-par".

6. Save, then check Files

Click Save Bucket. file.rocks doesn't test an S3-compatible connection when you save, so the bucket saves even if a detail is wrong.

Open Files to check. If the files in your bucket show up, your key, endpoint and bucket name are right.

If nothing loads, look at these again:

  • The Access Key ID and Secret Access Key
  • The region in the Endpoint
  • The Bucket Name
  • The preferred Project you picked for the API key

7. Upload a test file

Drop a small file into Files and see if it lands.

If your files list fine but uploads fail, check the CORS rule from step 3 first. Run get-bucket-cors again and make sure the origin is exactly https://www.file.rocks and PUT is in the list.

For more on uploading, see how to upload files to your own bucket. The Hetzner guide, the DigitalOcean Spaces guide and the MinIO guide walk through other Other S3-compatible setups. If you're still choosing a provider, cheapest cloud object storage compares the options.

Your files stay in the bucket you connected, and file.rocks is how you manage them.

How to connect Scaleway Object Storage to file.rocks | file.rocks Blog