Skip to main content

Connect CDN to S3

Last update:
For your information

These are instructions for connecting a CDN to an S3 bucket with content distribution via a personal domain.

  1. Create a public bucket in S3.
  2. Create a CDN resource.
  3. Create a personalized domain for the CDN resource.
  4. Add a personalized domain to the CDN resource.
  5. Check the CDN resource.

1. Create a public bucket

  1. In the control panel, on the top menu, click Products and select S3.

  2. Click Create Bucket.

  3. Enter the name of the bucket. For compatibility with the S3 API, the bucket name must be unique within S3 and conform to Amazon S3 bucket naming rules, see Amazon's Bucket naming rules documentation for more information.

  4. Select the type of buckets — public.

  5. Select a storage class:

    • standard storage — for storing and distributing frequently requested data;
    • cold storage — for storing rarely requested data.

    The storage class only affects the cost of resources, technically and in terms of speed the classes are the same. The storage class cannot be changed once the tank has been created.

  6. If you need a bucket with Virtual-Hosted addressing to work with S3 API, select vHosted in the Addressing Type block . You can enable Virtual-Hosted addressing only once.

  7. Click Create Bucket.

  8. Upload static content to the bucket that you want to distribute via CDN.

2. Create a CDN resource

  1. In the Control Panel, on the top menu, click Products and select CDN.
  2. Click Create CDN resource.
  3. Enter a name for the resource. The name has no effect on the resource settings and is used only for operation in the control panel.
  4. In the Content Source block, select S3 Selectel.
  5. Select the project in which you created a public bucket with content for the CDN.
  6. Pick a bucket.
  7. Click Create CDN resource.

3. Create a personal domain for the CDN resource

  1. Open your DNS hosting control panel.

  2. Create a third-level domain, such as cdn.example. com. This domain will be used as your personal CDN domain for content distribution.

  3. Create a CNAME record:

    • record type is CNAME;
    • record name is a subdomain of the form cdn.example.com;
    • value — default domain in *.selcdn.net format. You can view the domain in the control panel: in the top menu, click ProductsCDN → Resource page → General tab . Specify the domain without the protocol.

4. Add a personal domain to a CDN resource

  1. In the Control Panel, on the top menu, click Products and select CDN.
  2. Open the CDN resource page → General tab.
  3. In the Personal Domains block, click Add Domain.
  4. Specify the third-level domain you created as your personal domain.
  5. Click Connect.

5. Check CDN resource

  1. Make sure that at least 30 minutes have passed after all the settings — this time is necessary for the CDN resource to fully work.

  2. Open the object directly through the repository, to do this in the control panel in the top menu click ProductsS3 → bucket page. In the row of any object, click and follow the link in the Main Domain block.

    If the object does not open, there may be an access problem — for example, the bucket type has been changed to private or the object has been deleted.

  3. Open the object through the default CDN domain using a link like *.selcdn.net/images/image.png. If the object does not open, try again after some time. If the error persists, clear the cache and verify that you made the specified settings when creating the CDN resource.

  4. Open the object through the CDN personal domain using a link like cdn.example.com/images/image.png. If the object does not open, check that the CNAME record you added when you created the personal domain is correct.