Connect CDN to object storage
These are instructions for connecting a CDN to an object storage container with content distribution via a personal domain.
- Create a public container in the object store.
- Create a CDN resource.
- Create a personalized domain for the CDN resource.
- Add a personalized domain to the CDN resource.
- Check the CDN resource.
1. Create a public container
-
In the Control Panel, on the top menu, click Products and select Object Storage.
-
Click Create Container.
-
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 bucket naming rules, see the Bucket naming rules instructions in the Amazon documentation for details.
-
Select the container type to be public.
-
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 speed-wise the classes are the same. Once a container is created, the storage class cannot be changed.
-
If you need a container with Virtual-Hosted addressing to work with the S3 API, select vHosted in the Addressing Type block . You can enable Virtual-Hosted addressing only once.
-
Click Create Container.
-
Upload static content to the container that you want to distribute via CDN.
2. Create a CDN resource
- In the Control Panel, on the top menu, click Products and select CDN.
- Click Create CDN resource.
- 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.
- In the Content Source block, select Selectel Object Storage.
- Select the project in which you created the public content container for the CDN.
- Select a container.
- Click Create CDN resource.
3. Create a personal domain for the CDN resource
-
Open your DNS hosting control panel.
-
Create a third-level domain, such as
cdn.example
.com.
This domain will be used as your personal CDN domain for content distribution. -
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 Products → CDN → Resource page → General tab . Specify the domain without the protocol.
4. Add a personal domain to a CDN resource
- In the Control Panel, on the top menu, click Products and select CDN.
- Open the CDN resource page → General tab.
- In the Personal Domains block, click Add Domain.
- Specify the third-level domain you created as your personal domain.
- Click Connect.
5. Check CDN resource
-
Make sure that at least 30 minutes have passed after all the settings — this time is necessary for the CDN resource to fully work.
-
Open an object directly through the repository, to do this in the control panel in the top menu click Products → Object Repository → Container 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 container type has been changed to private or the object has been deleted.
-
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. -
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.