Working with Microservices-5: Creating “A” record in AWS Route 53 for the Microservice app that running in the Kubernetes cluster

If you want to see the microservice application running in your browser without entering the IP address, you must create an “A” record for the microservice app. So, we can reach the microservice application via DNS Name.

Cumhur Akkaya
7 min readJul 27, 2023

We will use a hosted zone to create an “A” record type by using AWS Route 53 domain registrar. Then we will bind it to our cluster that runs a “Java-based Springboot web microservice app” in this cluster.

Topics we will cover:

1. Technical concepts about Domain and URL should be known

2. Creating a Record

3. Creating a Hosted zone

4. As a result

5. Next post

6. References

1. Technical concepts about Domain and URL should be known

1. a. DNS: the “Domain Name System” is a mechanism that gives you the ability to connect to websites by associating human-readable domain names (ex:www.google.com) with a unique ID of the server (ex:74.125.224.147) on which a website is kept. This means that people can connect to a website using easy-to-remember domain names instead of hard-to-remember IP addresses. When you go to www.google.com in your browser, the request goes to the server with the IP address 74.125.224.147. (1)

You can obtain the DNS name from domain registrants such as AWS, GoDaddy, etc. Register domain page for AWS, as shown in Figure 1.

Figure 1

1. b. Hosted zone: A hosted zone is a container for records (So it’s not free, it’s paid. :-) ), and records contain information about how you want to route traffic for a specific domain, such as example.com, and its subdomains (acme.example.com, zenith.example.com). A hosted zone and the corresponding domain have the same name. Register domain page for AWS, as shown in Figure 2. (2)

Figure 2

1. c. Subdomain and Parts of a URL: A subdomain is an additional piece of information added to the beginning of your domain name.

Example: Google uses a subdomain for Gmail; “mail.google.com”. The subdomain here is “mail”. Despite the small URL change, you’re still on Google’s website. Just on a subdomain.

Now let’s explain this in an example, Parts of URL:

Figure 3

I will analyze the URL of the web page in Figure 3;

https:// is a protocol to the beginning (like HTTP or HTTPS).

portfolio is a subdomain. A subdomain comes before a second-level domain (SLD) in a URL.

cmakkaya-awsdevops The second-level domain (SLD) is what you choose to call your site (usually your business or brand name)

link The top-level domain (TLD) is the end of your domain (like “.com” or “.org”)

/projects.html is a page path.

We will use the subdomain when creating a record in AWS Route53, as shown in Figure 4.

Figure 4

Records: After you create a hosted zone for your domain, such as example.com, you create records to tell the Domain Name System (DNS) how you want traffic to be routed for that domain. (3)

For example, you might create records that cause DNS to do the following:
* Route internet traffic for example.com to the IP address of a host in your data center.
* Route email for that domain (cmakkaya@example.com) to a mail server (mail.example.com).
* Route traffic for a subdomain called operations.istanbul.example.com to the IP address of a different host.

Record types in AWS are shown in Figure 5.

Figure 5

2. Creating a Record

a. Sign in to the AWS Management Console and enter the Route 53 console at https://console.aws.amazon.com/route53/. Click Hosted Zones, as shown in Figure-6.

Figure-6

We will use a hosted zone (mine is “cmakkaya-awsdevops.link”) to create “A” record by using AWS Route 53. Then we will bind it to our “microservice app” cluster in Kubernetes.

You can obtain the DNS name from domain registrants such as AWS, GoDaddy, but I recommend that you buy it from AWS to be compatible with other services.

b. Now, select the domain name that you wish to configure, as shown in Figure-7.

Figure-7

c. Click Create Record Set to add a new record, as shown in Figure-8.

Figure-8

Then select “A — IPv4 address” for the record type, and enter the subdomain name into the “Record name” box but without the domain name. “Alias” will be closed, as shown in Figure-9.

“Value”: In this section, we will enter the public IP of any of the running nodes belonging to the Kubernetes cluster, as shown in Figures 9-10.

Finally, click on the “Create records” button.

Figure-9
Figure-10

We created an “A” record type for the microservices application’s cluster, as shown in Figure-11. So, without entering the IP address of the cluster, we can reach the microservice application via DNS Name.

Figures-11

The microservice application runs in my browser with my DNS name address, as shown in Figure-12.

Figure-12

Note: For the staging pipeline that we will create later in this series of articles: Don’t forget to enter this DNS “A” record into “DNS_NAME: “micoservices-app.cmakkaya-awsdevops.link” in the “values-template.yaml” file, as shown in Figure-13. We created “values-template.yaml” file in this article: “Microservice-4: Setting up a Helm v3 chart repository in Amazon S3 for CI/CD pipeline in Jenkins”. We will use it in the Jenkins staging pipeline that we will create.

Figure-13

3. Creating a hosted zone

If you don’t have a hosted zone for your domain, to create a hosted zone: click on the “Create hosted zone” button, as shown in Figure-7.

Enter “domain name” into the domain name box, then click on the “Create hosted zone” button, as shown in Figure-14.

Figure-14

Check the following procedures for detailed information:

a) To route internet traffic to your resources, such as Amazon S3 buckets or Amazon EC2 instances, see Creating a public hosted zone.

b) To route traffic in your VPC, see Creating a private hosted zone.

4. As a result

We created an “A” record type for a cluster, and without entering the IP address of the cluster, we can reach the microservice application via DNS Name.

We will implement what we have said here in this article: “Working with Microservices-7: Preparing the staging pipeline in Jenkins, and deploying the microservices app to the cluster with Helm.” We will prepare the staging pipeline in Jenkins, and deploy the Java-based Springboot web application consisting of 10 microservices to the cluster with Helm. The “Working with Microservices” series continues…

Share this article with friends in your network and help others to upskill.
I frequently share articles about Cloud and DevOps tools and resources. Follow me on Medium so you don’t miss future articles.

For more info and questions, please contact me on Linkedin.

5. Next post

Working with Microservices-6: Creating the Rancher server, Running Rancher in it, and Preparing Rancher to use in Jenkins Pipeline”, in Figure-15.

We will create a “Rancher server”, and deploy Rancher into a cluster in the Rancher server and examine the created cluster structure using Rancher menus. We will use Rancher in Jenkins Pipeline later.

Figure 15- Working with Microservices-6: Creating the Rancher server, Running Rancher in it, and Preparing Rancher to use in Jenkins Pipeline

We will do them all step by step.

--

--

Cumhur Akkaya

✦ DevOps/Cloud Engineer, ✦ Believes in learning by doing, ✦ Dedication To Lifelong Learning, ✦ Tea and Coffee Drinker. ✦ Linkedin: linkedin.com/in/cumhurakkaya