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

Connect CDN to object storage

For your information

This is an instruction to connect a CDN to an object storage container through a Selectel provider with content distribution through the personal domain.

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

Create a public container

  1. В control panels go to Object StorageContainers.

  2. Click Create a 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 S3's buckets naming rules, see the instructions for details Bucket naming rules Amazon documentation.

  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.

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

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

  7. Click Create a container.

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

Create a CDN resource

  1. В control panels go to CDNCDN resources.
  2. Click Create a 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. Select a Selectel provider.
  5. Select a content source Selectel Object Storage.
  6. Select project in which created a public container with content for the CDN.
  7. Select a container.
  8. Click Create a CDN resource.

Create a personal domain for the CDN resource

  1. Open your DNS hosting control panel.

  2. Create a third-level domain, e.g. cdn.example.com. This domain will be used as CDN personal domain for distributing content.

  3. Create a CNAME record:

    • record type is CNAME;
    • record name is a subdomain of the form cdn.example.com;
    • value — default domain in the format *.selcdn.net. You can view the domain in control panels under CDNCDN resources → resource page → tab General. Specify the domain without the protocol.

Add a personal domain to a CDN resource

  1. В control panels go to CDNCDN resources.
  2. Open the CDN resource page → tab General.
  3. In the block Personal domains click Add domain.
  4. Specify the third-level domain that you set up as a personal.
  5. Click Connect.

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 so in the control panels go to Object StorageContainers and open the container page. In the row of any object, click on  and follow the link on the block Main domain.

    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 the creating a CDN resource have made the specified settings.

  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 you opened the object is correct creating a personalized domain.