Skip to main content

Assigning a FQDN (Fully Qualified Domain Name) to an EC2 Instance Using Route 53

Hands-On Lab

 

Photo of Julie  Elkins

Julie Elkins

AWS Training Architect I in Content

Length

00:30:00

Difficulty

Beginner

In this hands-on lab, we will assign a fully qualified domain name to an EC2 instance using Route 53. Our first step will be to create an EC2 instance and set it up as a web server. Then, we will create two record sets in a provided hosted zone in Route 53. Finally, we will verify that the domain name is working by using the domain name to serve the newly configured web server.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Assigning a FQDN (Fully Qualified Domain Name) to an EC2 Instance Using Route 53

Introduction

In this hands-on lab, we will assign a fully qualified domain name to an EC2 instance using Route 53. Our first step will be to create an EC2 instance and set it up as a web server. Then we will create two record sets in a provided hosted zone in Route 53. Finally, we will verify that the domain name is working by using the domain name to serve the newly configured web server.

Solution

Log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.

Create an EC2 Instance

  1. Navigate to the EC2 dashboard, and click Launch Instance.
  2. On the AMI page, select the Amazon Linux 2 AMI.
  3. Leave t2.micro selected, and click Next: Configure Instance Details.
  4. On the Configure Instance Details page:
    • Network: Leave default
    • Subnet: us-east-1
    • Auto-assign Public IP: Enable
  5. Click Next: Add Storage, and then click Next: Add Tags.
  6. On the Add Tags page, add the following tag:
    • Key: Name
    • Value: FQDN EC2
  7. Click Next: Configure Security Group.
  8. Select Create a new security group.
  9. Click Add Rule, and set the Type to HTTPS.
  10. Click Add Rule, and set the Type to HTTP.
  11. Click Review and Launch, and then Launch.
  12. In the key pair dialog, select Create a new key pair.
  13. Give it a Key pair name of "FQDNEC2".
  14. Click Download Key Pair, and then Launch Instances.
  15. Click View Instances, and give it a few minutes to enter the running state.
  16. Once it's running, copy its public IP and paste it into a text file — we'll need it a few times in the rest of the lab.

Configure the EC2 Instance as a Web Server

  1. Open a terminal session.

  2. Make sure you're in your downloads directory.

  3. On the instances page of the AWS console, select our newly created instance and click Connect.

  4. Copy the chmod command in the dialog, and run it in the terminal.

  5. In the connection dialog, copy the ssh command, and run it in the terminal.

  6. Run a YUM update:

    sudo yum update -y
  7. Install Apache:

    sudo yum install -y httpd
  8. Ensure the web server starts if the instance is rebooted:

    sudo service httpd start
  9. Automate the web server starting:

    sudo chkconfig httpd on
  10. Open a new browser tab, and paste in the copied public IP address to verify our web server is up and running. It should result in the Apache test page.

Create Record Sets

First Record Set

  1. Navigate to Route 53 in the AWS console.
  2. Click Hosted zones.
  3. Select the listed zone.
  4. Click Go to Record Sets.
  5. Click Create Record Set.
  6. Set the following values:
    • Name: Leave as-is
    • Type: A — IPv4 address
    • Alias: No
    • TTL (Seconds): 300
    • Value: Paste in our instance's public IP address
    • Routing Policy: Simple
  7. Click Create.

Second Record Set

  1. Click Create Record Set.
  2. Set the following values:
    • Name: www
    • Type: A — IPv4 address
    • Alias: No
    • TTL (Seconds): 300
    • Value: Paste in our instance's public IP address
    • Routing Policy: Simple
  3. Click Create.
  4. After a few minutes, open a new browser tab and paste in the domain names for both record sets we created. They should both result in the Linux Apache test page.

Conclusion

Congratulations on completing this hands-on lab!