# Set Up a CDN Distribution with IONOS Cloud Object Storage as the origin

## Overview

A **Content Delivery Network (CDN)** is a network of distributed servers that can efficiently deliver web content to users across different geographic locations. This tutorial demonstrates the use of the following:

| **Components**                 | **Description**                                                                                                                                                                                                                                        |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Cloud DNS**                  | IONOS Cloud DNS lets you publish [<mark style="color:blue;">Domain Name System (DNS)</mark>](https://docs.ionos.com/support/general-information/glossary-of-terms#domain-name-system-dns) zones of your domains and subdomains on public name servers. |
| **Certificate Manager**        | IONOS Cloud Certificate Manager is a tool that simplifies the management of Secure Sockets Layer or Transport Layer Security (SSL or TLS) certificates for websites and applications.                                                                  |
| **IONOS Cloud Object Storage** | IONOS Cloud Object Storage is fully compatible with S3, so you can manage buckets and objects with existing S3 clients when correctly configured.                                                                                                      |
| **CDN**                        | IONOS Cloud Content Delivery Network.                                                                                                                                                                                                                  |

![Overview](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-1d23ffd8f0e87db0bd53ed93fc8b88c812d7878e%2Fgraph.png?alt=media)

## Target audience

This tutorial is intended to help both developers and technical decision-makers.

## What you will learn

In this tutorial, you will learn the process of setting up a CDN distribution for a domain using IONOS Cloud and the components mentioned in the [<mark style="color:blue;">Overview</mark>](#overview) section. This tutorial uses the `example.com` domain for demonstration purposes.

## Before you begin

To set up a **CDN distribution** using IONOS Cloud, it is mandatory to have a domain name. Example: `example.com`.

## Procedure

{% stepper %}
{% step %}
**Create a Zone**

To create a zone, follow these steps:

1\. In the **DCD**, go to **Menu** > **Network Services** > **Cloud DNS** > **Public zones** tab.

2\. Select **Create primary DNS Zone** and enter the following information:

| **Component**        | **Description**                      | **Example**              |
| -------------------- | ------------------------------------ | ------------------------ |
| **Enabled/Disabled** | Your zone is by default **Enabled**. |                          |
| **Name**             | Your desired domain or subdomain.    | `test.example.com`       |
| **Description**      | A description of the zone.           | My CDN distribution zone |

3\. Click **Create zone**.

![Create primary Zone](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-8af5bc246e4c84fccc0e19165d07a303b63621c2%2Fcreate-primary-zone.png?alt=media)

{% hint style="info" %}
The success message includes an option to copy the IONOS Cloud nameservers, which you can use to configure your domain at your registrar. Please note that DNS changes may take up to 48 hours to propagate and be effective. Verify that your nameservers in your domain registrar are correctly pointing to:

* `ns-ic.ui-dns.com`
* `ns-ic.ui-dns.de`
* `ns-ic.ui-dns.org`
* `ns-ic.ui-dns.biz`

<img src="https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-73dcdc139c493a5efda06d98300506ce13bbdf54%2Fcreate-primary-zones-msg.png?alt=media" alt="Zone successfully created" data-size="original">
{% endhint %}
{% endstep %}

{% step %}
**Create an Auto Certificate**

{% hint style="info" %}
**Note:** Before creating an Auto Certificate, ensure you [<mark style="color:blue;">create ACME provider</mark>](https://docs.ionos.com/cloud/security/certificate-manager/dcd-how-tos/create-acme-provider).

<img src="https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-f585e30662477f98d7faf946d1175f293c03dd69%2Fprovider.png?alt=media" alt="ACME Provider" data-size="original">
{% endhint %}

To create an Auto Certificate, follow these steps:

1\. In the **DCD**, go to **Menu** > **Security** > **Certificate Manager**.

2\. Click **Create Certificate** and select **Auto Certificate**.

3\. Enter the following information:

| **Section**              | **Component**             | **Description**                                                                          | **Example**        |
| ------------------------ | ------------------------- | ---------------------------------------------------------------------------------------- | ------------------ |
| **Certificate Provider** | Provider                  | Your ACME provider.                                                                      | `Let's Encrypt`    |
| **Properties**           | Certificate Name          | Unique identifier for the certificate.                                                   | `test.example.com` |
|                          | Common Name               | Common name for the certificate.                                                         | `*.example.com`    |
|                          | Key Algorithm             | RSA algorithm type. RSA is used for secure public-key encryption and digital signatures. | `RSA3072`          |
|                          | Subject Alternative Names | *(Optional)* Add up to 10 names for the certificate.                                     |                    |

![Auto Certificate Properties](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-6a560315ea5af2629eb0d9734ee891e791a8d6d3%2Fauto-certif1.png?alt=media)

4\. Click **Create** to create the Auto Certificate.
{% endstep %}

{% step %}
**Set up a User-owned bucket**

To set up a user-owned bucket, follow these steps:

{% hint style="info" %}
**Prerequisite:** You must have at least one active access key; otherwise, [<mark style="color:blue;">Generate a Key</mark>](https://docs.ionos.com/cloud/storage-and-backup/ionos-object-storage/get-started/generate-key) or [<mark style="color:blue;">activate</mark>](https://docs.ionos.com/cloud/storage-and-backup/ionos-object-storage/how-tos/manage-keys#activate-or-deactivate-a-key) an existing one.
{% endhint %}

1\. In the **DCD**, go to **Menu** > **Storage & Backup** > **IONOS Object Storage**.

2\. In the **Buckets** tab, click **Create a bucket**.

3\. Choose the **Bucket region** which determines the geographical location where the data inside the buckets will be stored.

![Create a Bucket](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-c03b27572231fd59bde4004dc0513d5290104330%2Fcreate-bucket1.png?alt=media)

4\. Enter a unique **Bucket name** that adheres to the [<mark style="color:blue;">naming conventions</mark>](https://docs.ionos.com/cloud/storage-and-backup/ionos-object-storage/concepts/buckets#naming-conventions) for a bucket.

{% hint style="info" %}
**Note:** The **Bucket name** must match the fully qualified domain name. Example: `test.example.com`.
{% endhint %}

![Create a Bucket](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-8660d3f5ad36048527422d41c7072177da3b91a6%2Fcreate-bucket2.png?alt=media)

5\. Click **Create bucket**.

{% hint style="info" %}
**Note:** A bucket will not be created if a bucket with the same name already exists in the IONOS Cloud Object Storage.
{% endhint %}

6\. Go to **Bucket Settings** > **Public access** > **Static Website Hosting**, specify your index and error documents and click **Enable**.

![Enable Static Website Hosting](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-af79340489152a12a44dce9f3dc2a3a09f123dce%2Fstatic-website-hosting.png?alt=media)

7\. Upload your website files to the bucket. Example: `index.html` or `.png`.

![Upload your website files](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-de23b5068f801b13e2897ac5a6a90e3d2b6528fe%2Fupload.png?alt=media)

{% hint style="info" %}
**Info:** You can create a website using the IONOS Cloud AI Model Hub [<mark style="color:blue;">Text Generation</mark>](https://docs.ionos.com/cloud/ai/ai-model-hub/how-tos/text-generation) feature.
{% endhint %}
{% endstep %}

{% step %}
**Create a CDN Distribution**

{% hint style="info" %}
**Prerequisite:** Ensure you have the corresponding permissions to create and manage CDN distributions. Only contract administrators, owners, and users with **Access and manage CDN** privilege can create a CDN distribution. For more information, see [<mark style="color:blue;">Set User Privileges</mark>](https://docs.ionos.com/cloud/network-services/cdn/dcd-how-tos/set-user-privileges-cdn-dcd).
{% endhint %}

1\. In the **DCD**, go to **Menu** > **Network Services** > **CDN**.

2\. Click **Create CDN distribution** from the **Distribution overview** page.

3\. Define distribution properties :

| **Component**       | **Description**                                                          | **Example**               |
| ------------------- | ------------------------------------------------------------------------ | ------------------------- |
| **Domain**          | Enter your domain.                                                       | `test.example.com`        |
| **SSL Certificate** | Enter the name of certificate you created using **Certificate Manager**. | `example-ssl-certificate` |

![Distribution properties](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-b87c9a7a9e72f4a3ee000d014a31ba37ea02cc57%2Fcdn-properties.png?alt=media)

4\. Define routing rules:

| **Component**        | **Description**                                                                                                                                                                                  | **Example**                          |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------ |
| **Prefix**           | Enter a prefix that helps the CDN determine the routing policies to apply for any URL path starting with the specified prefix.                                                                   | `/`                                  |
| **Scheme**           | Choose the transfer protocol type (`HTTP/HTTPS`, `HTTPS`, or `HTTP`). The CDN directs `HTTP` requests to `HTTP` and `HTTPS` requests to `HTTPS`.                                                 | `HTTP/HTTPS`                         |
| **Host**             | Enter the website host of the IONOS Cloud Object Storage.                                                                                                                                        | `s3-website-eu-south-2.example.com`  |
| **Caching**          | Turn on or off caching for responses from the upstream host. When enabled, content is cached and reused for subsequent requests.                                                                 | `On`                                 |
| **WAF**              | Turn on or off the Web Application Firewall (WAF) to protect the upstream host from threats and vulnerabilities.                                                                                 | `On`                                 |
| **Rate Limit Class** | Choose a rate limit class from the following to control the rate of incoming requests from specific IP addresses: `R1`, `R5`, `R10`, `R25`, `R50`, `R100`, `R250`, `R500`.                       | `R10`                                |
| **SNI Mode**         | Ensure you use the `origin` mode, instead of `distribution` mode, while configuring IONOS Cloud Object Storage.                                                                                  | `origin`                             |
| **Geo Restrictions** | Click **Open country list** to turn on or off countries to be blocked or allowed, then click **Save**. You can also enter a letter to navigate to the country code and choose to block or allow. | Allowed countries: `DE` , `FR` ,`ES` |

![Routing Rules](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-8721143af96151efe06de370932435cb4d8e1a6a%2Fcdn-routing-rules.png?alt=media)

5\. Click **Save** to apply the CDN distribution configurations.
{% endstep %}

{% step %}
**Point zone records to CDN**

1\. In the **DCD**, go to **Menu** > **Network Services** > **CDN**.

2\. In the **Distribution overview**, select the created CDN distribution.

3\. In the **Details & Edit CDN distribution**, copy the following IP addresses needed to configure the domain's DNS settings so that the CDN functionality can be active:

* **IPv4 address**
* **IPv6 address**

4\. Create two new records in your DNS zone pointing respectively to the IPv4 and IPv6 addresses.

{% hint style="warning" %}
**Enable Dual-Stack Connectivity:** To reach all global visitors, you must configure both A and AAAA records. While an A record handles IPv4 traffic, an AAAA record is essential for residential and mobile users on IPv6 networks. Omitting the AAAA record may degrade performance or cause connectivity issues for a significant portion of modern internet traffic.

When configuring Cloud DNS for this tutorial, ensure you point:

* The domain or subdomain A record to the IPv4 address.
* The domain or subdomain AAAA record to the IPv6 address.
  {% endhint %}

{% tabs %}
{% tab title="Record Type A" %}
To create a record, follow these steps:

1\. In the **DCD**, go to **Menu** > **Network Services** > **Cloud DNS** > **Public zones** tab.

2\. Select the appropriate zone in the **DNS ZONES** column to create records. Alternatively, click **Details & Records** in the **ACTIONS** column.

3\. Click **Create Record** in the **Details & Records** window.

4\. Enter the following details in the **Create Record** window:

| **Component**        | **Description**                                                                                                    | **Example** |
| -------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| **Enabled/Disabled** | Set the DNS record to either **Enabled** (default) or **Disabled**.                                                | `Enabled`   |
| **Name**             | Enter a name for your DNS record. Leave empty for an Apex record. Use `*` for a wildcard record.                   | `test`      |
| **TTL**              | Set the Time-To-Live in seconds. The default is 3600 seconds.                                                      | `60`        |
| **Type**             | Choose from available DNS record types.                                                                            | `A`         |
| **Content**          | Enter the content for the DNS record, typically an **IPv4 address** or relevant data depending on the record type. | `192.0.2.1` |

![Create Type A Record](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-1172c0d932987c53196e5d5a2088599647897d28%2Frecord-A.png?alt=media)

5\. Click **Save** to create the DNS record.

{% hint style="success" %}
**Expected result:** Your DNS record is now created.
{% endhint %}
{% endtab %}

{% tab title="Record Type AAAA" %}
To create a record, follow these steps:

1\. In the **DCD**, go to **Menu** > **Network Services** > **Cloud DNS** > **Public zones** tab.

2\. Select the appropriate zone in the **DNS ZONES** column to create records. Alternatively, click **Details & Records** in the **ACTIONS** column.

3\. Click **Create Record** in the **Details & Records** window.

4\. Enter the following details in the **Create Record** window:

| **Component**        | **Description**                                                                                                    | **Example**                    |
| -------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------ |
| **Enabled/Disabled** | Set the DNS record to either **Enabled** (default) or **Disabled**. `Enabled`                                      |                                |
| **Name**             | Enter a name for your DNS record. Leave empty for an Apex record. Use `*` for a wildcard record.                   | `test`                         |
| **TTL**              | Set the Time-To-Live in seconds. The default is 3600 seconds.                                                      | `3600`                         |
| **Type**             | Choose from available DNS record types.                                                                            | `AAAA`                         |
| **Content**          | Enter the content for the DNS record, typically an **IPv6 address** or relevant data depending on the record type. | `2001:db8:85a3::8a2e:370:7334` |

![Create Type AAAA Record](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-93bdf1f11d64c7aa96f7c71f7c64595826cf3e51%2Frecord-AAAA.png?alt=media)

5\. Click **Save** to create the DNS record.

{% hint style="success" %}
**Expected result:** Your DNS record is now created.
{% endhint %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Validate the Zone Records**

Verify that the A and AAAA records for your zone are correctly set up:

```bash
dig example.com A
```

The output should display the correct IP addresses for your zone.
{% endhint %}
{% endstep %}
{% endstepper %}

### Final result

Now you can access the website `https://test.example.com`. You can verify the benefits and performance of the configured **CDN** using any CDN performance testing tools.

## Conclusion

In this tutorial, you have successfully set up a CDN distribution for your domain using IONOS Cloud. Your website should now be accessible via the CDN, and you can enjoy improved performance and availability.
