Skip to main content

Connecting domain to your web service via DNS

This guide demonstrates how to create a DNS zone and set records within that DNS zone to connect your domain to a web application.

Basic information
  • Estimated time: 20 minutes
  • Recommended Operating system: MacOS, Ubuntu
  • Region: kr-central-2
  • Prerequisites:

Prerequisite

This document does not cover the configuration of a web service accessible via a domain. To proceed with this tutorial, you need the IP address of the web service to which the domain will be connected. Refer to the VM-based web service document to set up a web service accessible via a domain, or prepare the IP address of a pre-configured web server.

tip

KakaoCloud does not provide domain registration services. Please prepare a domain through an accredited domain registrar (e.g., Gabia, HOSTING.KR) in advance.

Step 1. Configure domain using DNS

The Domain Name System (DNS) translates machine-readable IP addresses into human-readable domain names and vice versa. DNS allows users to access websites using simple and easy-to-remember domain names instead of complex IP addresses. This step guides you through setting up a domain using KakaoCloud's DNS service and an external domain registrar.

  1. Go to KakaoCloud Console > Beyond Networking Service > DNS.

  2. In the DNS zone menu, click the [Create DNS zone] button and create a DNS zone with the following settings. For this tutorial, assume the domain to be registered is example.com. Replace example.com with your prepared domain.

    ItemInput
    DNS zone nameexample.com
    DNS zone description (optional)tutorial
  3. In the DNS zone list, click example.com, then check the KakaoCloud nameserver addresses at the top of the page.

  4. Navigate to the domain registrar where you purchased the domain, and set the nameserver to the KakaoCloud nameserver in the domain management page.

  5. Once you have verified the configuration, return to the KakaoCloud Console.

Step 2. Configure records for the domain name

DNS records provide information on how DNS servers should handle incoming requests. Each record type offers specific information or assists in directing web browsers to the correct server via DNS. This tutorial covers adding the most common types: A and CNAME records. For more detailed information on record types, see DNS Records.

To communicate with KakaoCloud's load balancer, you must associate a public IP with the load balancer and access it via this IP address. In this case, add an A record to map the load balancer's public IP address to the root domain, allowing access to the service via the mapped domain. You can add one or multiple public IP addresses.

Additionally, you can map the root domain to another domain using a CNAME record. Using a CNAME record helps avoid redundancy and manage subdomains more effectively. For example, if several subdomains point to the same IP address, you can update a single CNAME record instead of changing the IP address for each subdomain. If you wish to connect your domain using a CNAME record, follow the instructions in STEP 2-2. Add CNAME record.

info

DNS propagation can take time, and errors may occur when accessing the domain while the newly added records are being applied.

STEP 2-1. Add A Record

Follow these steps to add an A record that maps the domain to an IPv4 address.

  1. In the DNS > DNS zone tab, click example.com to navigate to the details page, then click the [Add Record] button at the bottom.

  2. Configure the following settings. To create a record for the root domain, leave the record name blank. Click the [Add] button to add the record.

    ItemSetting/Input
    Record TypeA
    Record Name(Blank)
    TTL60
    ValuePublic IP of the web server load balancer
    - Load Balancing > Load Balancer Tab > Public IP of tutorial-web-lb
  3. Enter example.com in a web browser. If connected successfully, you will see the 'KakaoCloud Library' service screen as shown below.

    A_Record_Success_Example

STEP 2-2. Add CNAME record

Follow these steps to add a CNAME record that maps one domain name to another.

  1. In the example.com DNS zone details page, click the [Add Record] button.

  2. Configure the following settings to map the root domain using a CNAME record.

    ItemSetting/Input
    Record TypeCNAME
    Record Namewww
    TTL60
    Valueexample.com.
  3. Enter www.example.com in a web browser. If connected successfully, you will see the 'KakaoCloud Library' service screen as shown below.

    CNAME_Record_Success_Example

Step 3. Verify results

You can also verify the results using the nslookup command. Enter the nslookup command on your local machine to check DNS information.

A Record example
nslookup example.com

Server: xxx.xxx.xxx.xxx
Address: xxx.xxx.xxx.xxx#53

Non-authoritative answer:
Name: example.com
Address: #.#.#.#
CNAME Record example
nslookup www.example.com

Server: xxx.xxx.xxx.xxx
Address: xxx.xxx.xxx.xxx#53

Non-authoritative answer:
www.example.com canonical name = example.com.
Name: example.com
Address: #.#.#.#

Appendix. Connect SSL/TLS certificate to the Application Load Balancer

An SSL/TLS certificate encrypts all data passing through the Load Balancer. This encryption prevents data from being read or altered during transmission, enhancing the security of web traffic. Additionally, most search engines prefer websites that use SSL/TLS, so implementing SSL/TLS can improve your website's search engine ranking.

You can connect an SSL/TLS certificate to the 7-layer Application Load Balancer by adding an HTTPS listener or to the 4-layer Network Load Balancer by adding a TLS listener. This example guides you through connecting an SSL/TLS certificate to the listener of an Application Load Balancer and enabling HTTPS communication between the web server and browser via the listener. The certificate used in this example is valid for both example.com and www.example.com.

tip

KakaoCloud does not issue certificates. It is recommended to obtain certificates from a CA for your registered domain.

STEP 1. Add listener

  1. In the Load Balancing > Load Balancer tab, click on the previously created tutorial-web-lb.

  2. Click the Listener tab at the bottom, then click the [Add listener] button on the right.

  3. Enter the following information to create a new listener.

    CategoryItemSetting/Input
    Protocol:Port settingsProtocolHTTPS
    Port443
    Default Forwarding TargetTarget Grouptutorial-web-target-group
    Min TLS versionTLSv1.2
    Default SSL CertificateCertificate for the above domains
  4. If you haven't registered a certificate yet, click the dropdown button, then click the [Add new certificate] button.

  5. Enter the following details, then click the [Add] button to add the certificate.

    CategoryItemSetting/Input
    SSL CertificatePrivate Key-----BEGIN RSA PRIVATE KEY-----
    Private Key
    -----END RSA PRIVATE KEY-----
    Certificate Body-----BEGIN CERTIFICATE-----
    Certificate
    -----END CERTIFICATE-----
    Certificate Chain-----BEGIN CERTIFICATE-----
    Certificate Chain
    -----END CERTIFICATE-----
    Tip

    Currently, KakaoCloud only supports PEM format certificates. If your downloaded certificates have .key or .crt extensions, you can easily change the file format by right-clicking the file and selecting Rename > Change the extension to .pem.

  6. Once all fields are filled, click the [Add] button to add the listener. It may take 3-5 minutes to complete the listener creation.

STEP 2. Redirect HTTP to HTTPS

  1. Click the listener with Protocol:Port set to HTTP:80, then click the [+ Add Rule] button at the bottom.

  2. Enter the following information, then click the [Add] button to add the rule. It may take 3-5 minutes for the rule to apply.

    CategoryItemSetting/Input
    Order settings1
    Condition settingsTypePath
    Value/
    Comparison methodExact
    Action settingsAction typeRedirect to URL
    ProtocolHTTPS
    URLwww.example.com

STEP 3. Verify result

If connected successfully, you will see that entering http://www.example.com or http://example.com redirects to https://www.example.com as shown below.

HTTPS Redirect