Hometutorials
s3 customize url cname

Update content

S3 Object Storage - Customizing URLs with CNAME

Reviewed on 16 February 2022Published on 21 May 2019
  • Object-Storage
  • CNAME
  • domain
  • S3
  • buckets

If you are using Scaleway Object Storage, you might not want the scw.cloud domain name to appear in your bucket’s URL. This may be the case if, for example, you are providing files to download or hosting the images of your website from a bucket. You may prefer a domain name such as download.mywebsite.com to display on your links, instead of download.mywebsite.com.s3.fr-par.scw.cloud.

In this tutorial, we show you how to use CNAME to map a domain or subdomain to an Object Storage bucket and access the files stored in the bucket via your own domain name.

Requirements:
  1. From the Scaleway console, create a new bucket. When entering a name for your bucket, the name must be exactly the same as the domain/subdomain intended to be used with it. For example, to create a bucket accessible at download.example.com the bucket name must be download.example.com.

  2. Set the bucket ACL with AWS-CLI:

    aws s3api put-bucket-acl --bucket download.example.com --acl public-read
  3. Log into the administration panel of your domain and create a new record that defines the hostname as an alias for the bucket. For example, if the bucket download.example.com is located in the Paris region, the CNAME should point to download.example.com.s3.fr-par.scw.cloud:

You can now access the file myapp.tar.gz stored in the bucket download.example.com directly at http://download.example.com/myapp.tar.gz instead of the usual URL http://download.example.com.s3.fr-par.scw.cloud/myapp.tar.gz.

Important:

SSL is not available when connecting to a bucket in this way.