One Page Zen

Web Design. Simplified.

  • Tutorials
    • Google Cloud
    • Amazon Cloud
    • Microsoft Cloud
  • Start
  • Resources

How to Transfer a Domain to AWS

November 12, 2020 Leron Amin 23 Comments

FacebookTweetLinkedInEmail

After you’ve installed an application such as WordPress on Amazon’s AWS, the next step is to transfer your domain name to AWS so that it links to your website.

Taking the time to properly configure a domain name for your website is an easy way to prevent search engine indexing issues from occurring.

By default, your public IP address will be used as the domain for your website. However, using a public IP address as your primary domain is bad for your website’s SEO.

If you would rather use a custom domain name such as yourwebsite.com, then read on for instructions on how to transfer your domain to AWS.

Before getting started with this tutorial, you should have already installed an application such as WordPress on an Amazon AWS EC2 virtual machine instance.

There are 7 steps in this tutorial:

  • 1. Copy Virtual Machine IP
  • 2. Create a Hosted Zone
  • 3. Add “A” Record
  • 4. Add “CNAME” Record
  • 5. Edit Domain Name Servers
  • 6. Test Settings
  • 7. Include www. Prefix (Optional)

1. Copy Virtual Machine IP

transfer domain to aws
Login to your Amazon Web Services (AWS) account, and click on the Services link at the top of the page.
install wordpress on aws
Under the Compute column, click on the EC2 link.
install wordpress on aws
Next, click on the Instances link in the left-sidebar column.
install wordpress on aws
Use the bottom scrollbar to navigate right to copy your instance’s Public IP address.

2. Create a Hosted Zone

transfer domain to aws
In the URL bar of a new browser window, navigate to Route 53 by entering the following URL: https://console.aws.amazon.com/route53/home
transfer domain to aws
Click the Get started now button on the Route 53 homepage.
transfer domain to aws
Next, click the Create Hosted Zone button at the top of the page.
transfer domain to aws
On the Create Hosted Zone page, enter your domain name in the Domain Name field, then click the Create button to create a new hosted zone.

3. Add “A” Record

transfer domain to aws
At the top of the Hosted Zones page, click on the Create Record Set button.
transfer domain to aws
In the Type field, select A Record, and paste your public IP that you copied in one of the previous steps into the Value field, then click the Create button at the bottom of the page.

4. Add “CNAME” Record

transfer domain to aws
Next, click the Create Record Set button at the top of the page to create another Record.
transfer domain to aws
Enter www in the Name field, and select CNAME as the record type. In the Value field, enter your domain, then click on the Create button.

5. Edit Domain Name Servers

transfer domain to aws
On your Hosted Zones homepage, copy the nameservers in NS section of the page.
transfer domain to aws
Head over to your Domain Name registrar (Name Cheap is used in this example) and assign the nameservers that you just copied to your domain.

6. Test Settings

transfer domain to aws
After a few minutes, try accessing your site by entering your domain name into the URL bar. If everything is configured properly, you will see your WordPress homepage.

7. Include www. Prefix (Optional)

By default, your domain will show without the www. prefix.

If you would rather your domain show up as www.example.com instead of just example.com, then read on for configuration instructions.

NOTE: The instructions below are intended for users running Bitnami’s WordPress stack on AWS. If you’re using a different Apache configuration, remember to substitute the bitnami.conf file with your server’s htaccess equivalent.

In order to add the www. prefix to your domain, you will first need to configure an SSH client to connect to your EC2 instance. To learn how to SSH into your EC2 instance, check out How to SSH into EC2 Instance (AWS).

transfer domain to aws configure www
After you SSH into your EC2 instance by following the instructions in this tutorial, copy and paste the command below to open your server’s configuration file (right-click to paste).
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf
transfer domain to aws configure www
Now that you’ve opened your server’s configuration file, copy and paste the three lines of code below in the exact same location as shown in the image. Save changes to the file (CTRL + O) then exit (CTRL + X) to the home screen.

  RewriteEngine On
  
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
transfer domain to aws configure www
Now that you’ve opened your server’s configuration file, copy and paste the three lines of code below in the exact same location as shown in the image. Save changes to the file (CTRL + O) then exit (CTRL + X) to the home screen.
sudo /opt/bitnami/ctlscript.sh restart apache

Did it work?

If you have general questions or comments about this tutorial, please feel free to leave them below.

If you benefited from this tutorial, and would like to support One Page Zen, please like our Facebook page and subscribe to our YouTube channel.

Thanks,

signature

transfer domain to azure
Transfer a Domain Name to AWS

Related Posts

  • How to Install WordPress on AWS
  • The Most Important Linux Commands (With Examples)
  • Increase 512MB Upload Limit for All-in-One WP Migration Plugin
  • How to Migrate WordPress Installations
  • How to SSH into EC2 Instances (AWS)
  • How to Migrate WordPress to AWS (Full Guide)
FacebookTweetLinkedInEmail

Filed Under: Amazon Web Services, AWS Networking, AWS WordPress Tagged With: aws, wordpress

Comments

  1. Leah-Kim Revel says

    August 17, 2020 at 9:21 am

    This is great- but what if I don’t want the ‘www.’? How can I make it only for the domain lacking the ‘www.’?

    Reply
    • Leron Amin says

      September 14, 2020 at 10:21 pm

      Hi Leah-Kim,

      You would set the preferred version of your domain name under WordPress Settings > General.

      You should also configure a redirect in your Apache configuration. I go over what an example redirect would like in step 4 of this tutorial.

      Let me know if you have other questions,
      Joe

  2. Ti says

    August 10, 2020 at 4:03 am

    Thanks a lot I connected a domain to AWS Lightsail with your guide. Thank you very much.

    Reply
    • Leron Amin says

      August 10, 2020 at 6:06 pm

      Thanks for the feedback Ti – glad to hear the guide was helpful!

  3. dan says

    February 18, 2020 at 4:33 am

    Hey Joe
    Thanks for all the tutorials really helped me with running my site.
    do you have a tutorial about implementing an SSL certificate with aws on wordpress?
    that would be so helpful

    Reply
    • Leron Amin says

      February 24, 2020 at 11:56 am

      Hey Dan,

      Thanks for the feedback!

      I don’t have an SSL tutorial for AWS at the moment – but I have received a lot of requests. Stay tuned!

      Talk to you soon,
      Joe

  4. Jyoti says

    June 29, 2019 at 10:55 am

    Hi Leron,

    Great tutorial!
    I am having trouble with finding appropriate config file to tweak “www” part. I am not using Bitnami, instead I have Apache+mysql+php installed on my AWS EC2 instance and for now I am just using index.html located in /var/www/html/. Do you have any idea ?

    Thanks for help!

    Reply
    • Leron Amin says

      July 8, 2019 at 5:02 pm

      Hi Jyoti,

      Your Apache configuration files are located in the following location:
      /etc/apache2/sites-available/

      Navigate to this location, and add the directives to your apache2.conf file.

      Let me know if you have questions,
      Joe

    • Jyoti says

      July 11, 2019 at 12:00 am

      Great! Thanks Joe.

  5. David C says

    June 15, 2019 at 3:52 pm

    Thanks for the tutorial.
    How do I manage my Google domain to point to EC2 website without using AWS Route 53?

    Reply
    • Leron Amin says

      June 17, 2019 at 5:05 pm

      Hi David,

      You can visit your domain registrar and create an A record with the IP address of your VM instance.

      Try following the instructions in this guide here, minus the last step.

      Let me know if you have questions,
      Joe

  6. sean says

    November 2, 2018 at 3:45 pm

    Howdy! This is a great tutorial however it needs an update. Please update!

    Reply
    • Leron Amin says

      November 3, 2018 at 7:57 pm

      Thanks for the information Sean – I will update the tutorial!

  7. Sapam.S says

    October 8, 2018 at 2:13 pm

    can you add a bit more on how to add an elastic ip with our hosting? My site went down after i attatched an elastic ip. Some help

    Reply
  8. TJ says

    October 5, 2018 at 4:44 pm

    This doesn’t work anymore.

    Reply
    • Leron Amin says

      October 5, 2018 at 5:17 pm

      Hi TJ,

      Please provide additional details as to why it doesn’t work anymore, and I will look into updating the tutorial.

      Thanks,
      Joe

  9. Mike says

    June 20, 2018 at 9:14 am

    Can you please put up an article on How to log into phpmyadmin page especially for Bitnami stack? You have to “tunnel in” into it and is very complicated. Please consider!

    Reply
    • Leron Amin says

      June 20, 2018 at 1:38 pm

      Hey Mike,

      Thanks for reaching out!

      I’ve already published an article on how to configure SSH tunnels, and you can view it here. Be sure to check out the comments at the bottom of that tutorial as well, as some experienced developers have gone over problems that they faced and solutions on how to resolve them.

      Let me know if you have any questions,
      Joe

  10. patrick perez says

    May 10, 2018 at 3:28 pm

    I still have to buy the domain name before proceeding right? And is there a way to do it through Amazon instead of other services?

    Reply
    • Leron Amin says

      May 10, 2018 at 4:01 pm

      Hi Patrick,
      You can buy a domain directly through Amazon’s Route53, but I’ve never done this before so I can’t recommend it.
      Hope this information helps,
      Joe

  11. Ay says

    April 6, 2018 at 6:07 am

    Hello my friend
    the Route53 service not included in the free tier in Amazon
    Are there any way to use AWS EC2 with Cloudflare without using Route53
    or any way to add the domain to AWS EC2 without using Route53

    Reply
    • Leron Amin says

      April 6, 2018 at 8:09 pm

      Hi Ay,

      Yes you can, just follow this tutorial here.
      To do this in CloudFlare would be more complicated, as CloudFlare requires that you use their nameservers. It’s something you’d have to look into.

      Good luck and let me know if you have any questions,
      Joe

  12. Leron Amin says

    November 28, 2017 at 2:51 pm

    Did this tutorial work for you?
    Please share your questions and comment below!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Want Exclusive Tutorials?

Welcome to One Page Zen!

Through this blog I hope to introduce web developers to cloud computing!

author-bio

facebook-support-group kinsta-cloud-hosting

Want Exclusive Tutorials?


Contact | Sitemap | Legal | Privacy Policy | Affiliate Disclosure
      Copyright © 2017 - 2019 One Page Zen
Share this Article

Email sent!