Adding an extra layer of CDN to your private buckets will ensure that you have better data availability and security alongside the benefits of Merlin Storage. You can follow the steps below to ameliorate your data storage:
1. Open the Merlin Panel via this link and click the “Bucket” button under the Storage tab of the main menu.
2. If this is the first time you are using Storage, click on "Get Started". Otherwise, you will be directed to the Buckets page automatically.
3. Click on "Create Bucket". If this is the first time you are creating a bucket, you can follow the steps in this article.
4. Click on the bucket's name you want to add CDN.
5. Click on "Bucket Settings" on the left side menu.
6. Copy and note the "Bucket Endpoint" URL, will need it later.
7. Click on "Edit Policy".
8. On the pop-up, click on the "Set Default Policy" button.
9. Copy and note the aws referer, will need it later.
10. Click on "Save Changes".
11. On the left navigation bar, click on "Distributions".
12. If this is the first time you are creating a distribution, you will be directed to this page, then click on "Create Distribution".
Otherwise, you will be directed to your Distributions page. Click on "Create Distribution".
13. You can follow the steps in this article if you are creating your first distribution. In the Origin Server area, enter the bucket endpoint URL you copied in step 6.
14. Click on "Create Distribution".
15. Click on "Origins" on the left side menu.
16. Click on "Default Origin".
17. Scroll down to the "Custom Headers" section and enter the header name in the related area and then enter the aws referer you copied before in step 9 in the Header Value box.
18. Click on "Update Origin".
19. In the Servers section, enter the bucket endpoint URL you copied in step 6 in the "Domain or IP" area.
20. Click on "Add Server".
21. You might see some lines containing IPs that you should delete safely using the cross icon on the left side of the row (✕) until the one you added in step 20 is the only one left.
You added CDN to a private bucket as an extra layer. The objects uploaded to this bucket will be accessible by CDN servers. If you need more information about uploading objects to buckets, this article will be helpful.