How To: Custom Domain For EC2 Web Server (3 Min) | AWS Route 53 | Using A DNS Record In Hosted Zone

Gokce DB
1 Apr 202303:19

Summary

TLDRABI from gokjdb presents a tutorial on configuring a custom Route 53 domain to point to an EC2 instance's web server in AWS. The video guides viewers through launching an EC2 instance, setting up security groups to allow SSH and HTTP traffic, and inserting a bash script for an HTTP server with a 'Hello World' message. It concludes with setting DNS records in Route 53 and verifying the setup's success through a browser, ensuring a seamless domain-to-server connection.

Takeaways

  • πŸš€ Start by navigating to the EC2 service in AWS to launch a new instance.
  • πŸ› οΈ Give your instance a name, select an AMI, instance type, and choose a key pair.
  • πŸ”’ In network settings, configure the security group to allow SSH and HTTP traffic from anywhere.
  • πŸ“ In the 'Advanced Details' section, add a user data script to install and start the httpd web server, and write a 'Hello World' message in HTML.
  • πŸ’» Launch the instance and wait for it to be in the 'running' state from the EC2 dashboard.
  • 🌐 Copy the public IP address of the EC2 instance and test the httpd server by accessing it through a web browser.
  • πŸ“ Navigate to the Route 53 service to manage domain routing.
  • πŸ“¦ Inside your hosted zone, create a new record for routing traffic to your EC2 instance.
  • πŸ” Choose 'Simple' routing policy and define a subdomain, such as 'ec2-test', with an 'A' or 'Alias' record type pointing to the EC2 instance's public IP.
  • ⏱️ Wait for the DNS changes to propagate, which will show as 'Pending' and then 'In Sync'.
  • πŸ”— Test the new subdomain in a browser to confirm that it routes correctly to the EC2 web server.

Q & A

  • What is the purpose of the video by ABI from gokjdb?

    -The purpose of the video is to teach viewers how to point a custom Route 53 domain to a web server running on an EC2 instance in AWS.

  • How does one begin the process of setting up an EC2 instance for a web server?

    -The process begins by navigating to the EC2 service, clicking on 'Launch Instance', naming the instance, selecting an AMI and instance type, and choosing a key pair.

  • What security group settings are recommended in the video for allowing SSH and HTTP traffic?

    -In the video, it is recommended to allow SSH traffic from anywhere and HTTP traffic from anywhere in the security group settings.

  • What is the role of the user data section in launching an EC2 instance?

    -The user data section is used to input a bash script that automates the installation and configuration of the web server, such as installing httpd and starting it.

  • What does the bash script in the user data section do in the context of the video?

    -The bash script installs the httpd web server, starts it, enables it to start on boot, and writes a 'Hello World' message within H1 tags to the index.html file.

  • How can you check if the EC2 instance is running and the web server is operational?

    -You can check by copying the public IP address of the EC2 instance and pasting it into a browser. If the 'Hello World' message is displayed, the web server is operational.

  • What service in AWS is used to manage domain names and DNS settings?

    -The Route 53 service in AWS is used to manage domain names and DNS settings.

  • What is a hosted zone in Route 53 and how does it relate to the video?

    -A hosted zone in Route 53 is a container for DNS records for a domain. In the video, the viewer is instructed to navigate to their hosted zone to create a new record for routing.

  • What type of record is created in Route 53 to point a custom domain to an EC2 instance?

    -A simple routing policy record is created in Route 53 to point a custom domain to an EC2 instance.

  • What is the difference between choosing 'A - IPv4 address' and 'Alias' for the record type in Route 53?

    -Choosing 'A - IPv4 address' requires you to manually input the IP address of the EC2 instance, while 'Alias' allows Route 53 to automatically route to the instance based on the instance ID.

  • How can you confirm that the DNS changes have propagated and are in sync?

    -You can confirm by checking the status of the DNS change in Route 53. It should change from 'Pending' to 'In Sync' after a few minutes.

  • What is the final step to verify that the custom domain is routing to the EC2 web server?

    -The final step is to open a browser session and navigate to the new subdomain to see if it displays the web server's content, confirming the routing is successful.

Outlines

00:00

🌐 Setting Up a Web Server on EC2 with Route 53

In this video, ABI from gokjdb guides viewers through the process of setting up a custom Route 53 domain to point to a web server running on an EC2 instance in AWS. The tutorial begins with launching an EC2 instance, naming it, selecting an AMI, instance type, and key pair. Special attention is given to the security group settings, where SSH and HTTP traffic are allowed from anywhere. The user data section is used to install the httpd web server, start it, enable it, and write a 'Hello World' message in the index.html file. After launching the instance, the public IP address is used to confirm that the web server is running. The video then proceeds to the Route 53 service, where a hosted zone is selected, and a new record is created. The record is set up to route traffic to the EC2 instance using its public IPv4 address. The DNS change is monitored until it is in sync, and finally, the video concludes with a browser session confirming that the new subdomain is routing correctly to the EC2 web server.

Mindmap

Keywords

πŸ’‘Route 53

Route 53 is a scalable and highly available Domain Name System (DNS) web service provided by Amazon Web Services (AWS). It is designed to give developers and businesses an extremely reliable way to route end users to Internet applications, such as websites or web services. In the video's context, Route 53 is used to point a custom domain to an EC2 instance, ensuring that the domain resolves to the correct IP address where the web server is hosted.

πŸ’‘EC2 Instance

An EC2 (Elastic Compute Cloud) instance is a virtual server in the AWS cloud that can be used to run applications or perform computing tasks. The video script describes launching an EC2 instance, which is the foundation for setting up a web server. The instance is configured with a name, AMI (Amazon Machine Image), instance type, and key pair, and is the platform on which the HTTPD web server is installed and run.

πŸ’‘AMI (Amazon Machine Image)

An Amazon Machine Image (AMI) is a pre-configured virtual machine image, available in the AWS Marketplace, that contains the necessary information to launch a virtual server. In the video, selecting an AMI is part of the EC2 instance setup process, which provides the base environment for the web server installation.

πŸ’‘Security Group

A security group in AWS is a virtual firewall that controls inbound and outbound traffic to EC2 instances. The video mentions configuring a security group to allow SSH traffic from anywhere, which is essential for remote access to the instance, and HTTP traffic from anywhere, which is necessary for the web server to be accessible over the internet.

πŸ’‘User Data

User data is a feature in AWS that allows scripts to be executed when an EC2 instance is launched. In the video, a bash script is provided in the user data section to automate the installation of the HTTPD web server, start it, and enable it to run automatically after the instance is launched. This script also writes a 'Hello World' message to the index.html file.

πŸ’‘HTTPD Web Server

HTTPD is a common web server software that serves static content and runs on Unix-based systems. In the script mentioned in the video, HTTPD is installed on the EC2 instance to serve web pages. The script also configures the server to display a 'Hello World' message when accessed via a web browser.

πŸ’‘Public IP Address

A public IP address is an IP address that is reachable from the internet. In the context of the video, after the EC2 instance is running, its public IP address is used to test the HTTPD web server by accessing it through a web browser. This IP address is later replaced by a domain name via Route 53.

πŸ’‘Hosted Zone

A hosted zone in Route 53 is a container for records, such as resource record sets, that define how you want to route traffic for a domain. In the video, the user navigates to the hosted zone for their domain to create a new record that will direct traffic to the EC2 instance's web server.

πŸ’‘Record Type

In DNS, a record type defines the purpose of a DNS record. The video script mentions creating an 'A' record, which maps a domain or subdomain to an IPv4 address, and an 'Alias' record, which is used to route traffic to an AWS resource, such as an EC2 instance, by its name rather than an IP address.

πŸ’‘DNS Change

A DNS change refers to the process of updating DNS records, which can include adding, modifying, or deleting records. In the video, after creating a new record in Route 53, there is a period where the change is in a 'pending' state before it becomes 'in sync', indicating that the DNS update has propagated across the internet.

πŸ’‘Subdomain

A subdomain is a part of a domain that can be used to create a separate section of a website or to delegate a portion of the domain to another set of servers. In the video, 'ec2.test' is chosen as a subdomain to point to the EC2 instance, demonstrating how to direct traffic to a specific part of a website or service.

Highlights

Introduction to the video by ABI from gokjdb on configuring a custom Route 53 domain to an EC2 instance in AWS.

Starting the process by navigating to the EC2 service and clicking on 'Launch Instance'.

Naming the instance, selecting an AMI, instance type, and key pair.

Configuring network settings to allow SSH and HTTP traffic from anywhere.

Expanding the 'Advanced Details' bar and accessing the 'User Data' section.

Inserting a bash script to install the httpd web server, start it, and enable it.

Adding a 'Hello World' message within H1 tags in the index.html file.

Launching the instance and waiting for it to change to a 'Pending' state.

Checking the EC2 dashboard for the instance to eventually change to a 'Running' state.

Copying the public IP address and testing the httpd web server by accessing it in a browser.

Navigating to the Route 53 service and accessing the 'Hosted Zones'.

Creating a record within the hosted zone for routing policy.

Choosing a subdomain and setting the record type to A or Alias.

Defining the record with the EC2's public IPv4 address.

Creating the records and checking the DNS change status.

Waiting for the DNS change to sync and confirming the routing to the EC2's web server.

Final confirmation of the new subdomain routing to the EC2's web servers.

Encouraging viewers to leave questions in the comments, like, subscribe, and turn on notifications.

Transcripts

play00:00

hi guys this is ABI from gokjdb and in

play00:03

this video you're going to learn how to

play00:06

point your custom Route 53 domain to a

play00:10

web server running on an ec2 instance in

play00:13

AWS let's get into it

play00:16

[Music]

play00:18

let's start by navigating to the ec2

play00:21

service then click on launch instance

play00:24

then give your instance a name select an

play00:28

Ami an instance type then choose a key

play00:31

pair in the network settings for the

play00:35

security group attention I'm going to

play00:38

allow SSH traffic from anywhere and HTTP

play00:42

traffic from anywhere expand the

play00:45

advanced details bar then scroll down to

play00:49

the user data section here I'm going to

play00:52

copy paste the bash script keep your

play00:55

formation that installs the httpd web

play00:59

server starts it then enables it I'm

play01:03

also writing the hello world message

play01:05

within the H1 tags to index.html

play01:10

hit launch instance then go back to the

play01:14

ec2 dashboard your instance should now

play01:17

be in pending State give it a few

play01:20

minutes

play01:21

[Music]

play01:23

and your ec2 instance should eventually

play01:27

change to running State copy the public

play01:31

IP address and paste it in a browser

play01:34

session and you should see your hello

play01:36

world message

play01:40

this means that our httpd web server is

play01:45

running as expected next let's navigate

play01:48

to the Route 53 service then click on

play01:51

hosted zones go inside your hosted zone

play01:55

for me it's gokjdb.com then click on

play01:59

create record

play02:01

for routing policy I'm going to choose

play02:04

simple then hit next

play02:07

click on Define simple record then enter

play02:10

a subdomain I'm going to choose ec2 test

play02:14

as my subdomain and leave the record

play02:16

type to a or Alias for endpoint choose

play02:21

IP address then copy paste the ec2's

play02:25

public ipv4 address in the text box

play02:28

that's what I'm talking talking about

play02:32

it defines simple record then click on

play02:35

create records if you click on view

play02:39

status your DNS change should now be in

play02:43

pending State give it a few minutes

play02:49

and it should eventually change to in

play02:51

sync finally let's open a browser

play02:54

session and confirm that our new

play02:57

subdomain is routing to our ec2's web

play03:00

servers

play03:04

[Music]

play03:05

there you have it if you have any

play03:07

questions leave them in the comment

play03:09

section below don't forget to like

play03:12

subscribe and turn on the notification

play03:14

Bell until next time

play03:18

[Music]

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
AWSEC2Route 53Web ServerTutorialCustom DomainHTTPdSSHHello WorldDNS SetupServer Deployment