Skip to main content

Connect 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 OS: MacOS, Ubuntu
  • Prerequisites:

About this scenario​

This tutorial explains how to use KakaoCloud DNS to connect a domain to a web service.

You will learn how to:

  • Connect an externally registered domain to KakaoCloud DNS
  • Configure a DNS zone and A/CNAME records
  • Apply an SSL/TLS certificate to an Application Load Balancer
  • Redirect HTTP traffic to HTTPS

Before you start​

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.

Get started​

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 > Networking > DNS.

  2. In the DNS zone menu, select 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, select 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.

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, select example.com to navigate to the details page, then select 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. Select 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

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, select 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, select on the previously created tutorial-web-lb.

  2. Select the Listener tab at the bottom, then select 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 certificateCertificate for the above domains
  4. If you haven't registered a certificate, click [Management page] in the Default certificate dropdown menu to go to Certificate Manager. Follow Register certificate to register the certificate.

  5. Return to the Load Balancing listener creation page, refresh the page, and select the registered certificate under Default certificate.

  6. After entering all required information, click [Add] to add the listener. Listener creation can take 3–5 minutes.

STEP 2. Redirect HTTP to HTTPS​

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

  2. Enter the following information, then select 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