Skip to main content
Connect CDN to object storage
Last update:

Connect CDN to object storage

For your information

These are instructions for connecting a CDN to an object storage container via a Selectel provider with content distribution via personal-domain.

  1. Create a public container in the object store.
  2. Create CDN-resource.
  3. Create a personal domain for the CDN resource.
  4. Add personal domain to CDN-resource.
  5. Check CDN-resource.

1. Create a public container

  1. In Control Panel, go to Object StorageContainers.

  2. Click Create Container.

  3. Enter a name for the container. For compatibility with the S3 API, the container name must be unique within the object store and conform to Amazon's S3 bucket naming rules, see the Bucket naming rules instructions in Amazon's documentation for details.

  4. Select the container type to be public.

  5. Select a storage class:

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

    Storage class only affects resource cost, technically and speed-wise the classes are the same. Once a container is created, the storage class cannot be changed.

  6. Optional: if you need a container with Virtual-Hosted-Style addressing to work with the S3 API, in the Addressing block, check the Virtual-Hosted checkbox. You can enable Virtual-Hosted addressing only once.

  7. Click Create Container.

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

2. Create a CDN resource

  1. In Control Panel, go to CDNCDN Resources.
  2. Click Create CDN resource.
  3. Enter the name of the resource. The name has no effect on the resource settings and is only used in the control panel.
  4. Select a Selectel provider.
  5. In the Content Source block, in the Domain or IP address field, specify the public domain of the container like *.selstorage.ru. You can view the domain in control panel under Object StorageContainers → Container page → Domains tab.
  6. Click Create CDN resource.
  7. Open the page of the created CDN resource.
  8. Open the General tab.
  9. In the Content Source block, click Edit Source.
  10. In the Host header override field, specify the public domain of the container of the form *.selstorage.ru. You can view the domain in control panel under Object StorageContainers → Container page → Domains tab.
  11. Click Save.

3. Create a personal domain for 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 a 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 is the default domain in *.selcdn.net format. You can view the domain in control panel under CDNCDN resources → resource page → General tab. Specify the domain without the protocol.

4. Add a personal domain to the CDN resource

  1. In Control Panel, go to CDNCDN Resources.
  2. Open the CDN resource page → General tab.
  3. In the Personal Domains block, click Add Domain.
  4. Specify the third-level domain that you created as a personal domain.
  5. Press Connect.

5. Check the 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 control panel go to Object StorageContainers and open the container page. In the subject line of any object, click on  and follow the link in the Main Domain block.

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

  3. Open the object through the default CDN domain using a link of the form *.selcdn.net/images/image.png. If the object does not open, check that you made the specified settings when create CDN-resource.

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