Continuous Deployment using GitHub Actions and AWS EC2 — Part II: Configure Domain via Route 53

Mansoor Khan
3 min readApr 30, 2023

--

Alright so in the last article, we learned how to create an EC2 instance and how to successfully connect to it via SSH.

In this article, we will learn how to configure a domain so that it points to our EC2 instance. We will also learn how to serve a basic landing page of our domain with Nginx web server (in the next part).

First of all, create an EC2 account if you haven’t already. Once you’re done, log into your account and find Route 53 in the services section on the top left of your AWS console.

With Route 53, you can manage your websites’ traffic, monitor your web applications and register/route your domain to your EC2 instance.

On the Route 53 interface, click on Hosted Zones from the left sidebar and then click on Create hosted zone button on the right. It will take you to the following page:

On this page, write the name of your domain and click on Create hosted zone button at the bottom. This will create a new domain record with two default entries: SOA and NS. Leave them as it is.

Click on Create record to add more entries for the domain which takes you to the Routing policy page.

The routing policy determines how Amazon Route 53 responds to queries. You can learn more about routing policies here. In our case, we will go with Simple routing. Click on next to go to the Configure records screen.

Configure records on Route 53

This page let’s you create multiple records at a time that have the same routing policy.

Click on Define simple record. This will open up a popup screen.

Route 53: Define a simple record

Leave the record name blank for now. Choose A — Routes traffic to an IPv4 address and some AWS resources from the Record type dropdown. Choose IP address or another value option from the Value/Route traffic to option and add your instance’s public IP address. Click on Define simple record to create this entry.

Repeat the above process to add a CNAME alias for your domain. You can do that by adding * (astertisk) in the Record name, choosing CNAME — from the Record type dropdown and adding your domain name in the Value input field.

Following these steps you will be able to route your domain’s traffic to your EC2 instance. In the next tutorial of this series, we will learn how to serve a basic landing page for our domain using a webserver (Nginx).

Feel free to reach out to me if you have any questions.

Stay tuned!

Previous articles in this series

--

--