Amazon EC2 nameservers with WHM

Setting up Amazon EC2 is quick and easy, you can build a server within less than an hour.

I initially used a great guide posted by Rob Scott which shows how to setup a VPC with security group, an EC2 instance and then how to install WHM on it. I used the guide as reference to my own way of doing it though and it gave me the foundation I needed, especially being unfamiliar with AWS.

The guide tells you how to use Route53 for the DNS which I didn’t follow. I wanted to setup my own, private nameservers. The main reasons were aesthetic (the looks of it in WHOIS) and also so that I could point all my domains to the same two nameservers and never have to change them. If an IP ever had to be swapped out, I could just change the IP at the registrar but the nameservers would remain the same.

I assume that you’ve followed the guide to the point where you have a running Amazon EC2 instance, one network interface with one private IP and an elastic IP associated to that which is public and that you have then installed WHM. If you haven’t started the WHM install yet, that is okay, you can do the IP configuration during the installation of WHM.

So follow these steps to setup private nameservers on Amazon EC2 running WHM:

1. Manage private and elastic IPs

In the guide as mentioned above, Rob showed you how to create one, primary IP address which is private. He then also showed you to create an elastic IP and associate it with that private IP address you created. We want to create another private and public/elastic IP. One for each nameserver.

Now go to your AWS console and go to EC2. Then click “Instances” where you’ll see all your instances. Select the specific instance and click “Actions” at the top or right-click on the instance name. Then select “Manage Private IP Addresses“. Click “Assign New IP” and leave the box on “Auto Assign” and make sure you tick/check the “Allow reassociation” checkbox and then update. It created for me.


Now go to Network & Security > Elastic IPs in your EC2 dashboard. Click the “Allocate New Address” button at the top to create an IP address. Once it has been created, select the elastic IP and click “Associate Address” at the top or right-click on it and select “Associate Address“. A dialog will appear.

Leave the instance empty and under network interface, click inside the field to load the network interfaces. Now choose the same network interface that you created the primary, private IP address on. Then under “Private IP Address“, select the private IP that we just created in the previous step and then tick/check the “Reassociation” checkbox and click “Associate” to finish.


That’s it for this step. You now have two private IPs on the network interface of the instance and you have two public, elastic IPs, each associated to one of the private IP addresses.

2. WHM IP Address Setup

If you haven’t installed WHM yet, you can do that now and it will allow you to add IP addresses during the setup process after installation.

If you have already installed WHM, you can go to IP Functions > Add New IP Address in WHM.

For both, remember that by default, it will be in NAT mode so you’ll enter the private IP addresses into WHM and not the elastic IPs. WHM will automatically route the private IP addresses to their associated elastic IPs for you, don’t worry about that.

In this case, the private IP that we just created was So I’ll enter that into the box and submit it. Do the same for your other private IP address that you created on the instance earlier on in Rob’s guide accordingly. Again, do not enter the elastic IP, it will not work, it will just be unroutable unless you are not in NAT mode.


That’s it for the WHM setup. WHM will automatically route the private IP addresses to the elastic IPs and do the work for you.

3. Register Nameservers at Registrar

Now we need to register the private nameservers for our IP addresses at the registrar where the domain is registered or you could use a 3rd party DNS service if you wanted to but in this case I wanted the nameservers to be and where is my domain.

If you don’t have a domain that you want to use for the nameservers, you can just go and register one right now.

Login to your account at your registar like GoDaddy or Dynadot for example. Each registrar will give you documentation or help on registering private nameservers/hostnames so I’m not going to post different registrars here but I’ll give you the instructions for GoDaddy and Dynadot. Both are equally easy to do but GoDaddy seems very slow to propagate DNS compared to Dynadot from my experience. That is also why I have moved most of my domains over.


Once you are logged into your GoDaddy account, click the “Launch” button next to “Domains“. Then you’ll be shown a list of domains where you’ll click the name of the domain that you’ll be using for the private nameservers.

On the domain details page, scroll down inside the “Settings” tab until you see “Host Names“. Then click “Manage” link which will open a dialog where you will click “Add Hostname“. Fill in the name of the nameservers that you want, eg. and then the one elastic IP that you associated to the instance through the network device earlier on. Then do the same for the second nameserver eg. and the other elastic IP you associated to the other private IP address.


Go to Domains, then you’ll see a list of all your domains.

For the specific domain that you want to use for the two nameservers, click on the link in the “Name Server” column of the table. It will take you to a page where you will see several choices such as name servers, parking, forwarding, etc. Select the “Name Servers” tab and directly under that click the “manage name servers” link. Then on the next page just click the “Register a domain name server” link.

So you will be presented with a form. First fill in the nameserver you wish to have eg. and then in the next field, fill in your one elastic IP address that you previously associated with your instance through the network interface. Then submit and do the same thing a second time using another nameserver eg. and the other elastic IP you associated to the other private IP address on the instance.


4. Test Nameservers

WHM will automatically update itself with your new nameservers after several hours as the DNS has propagated. You can go to DNS Functions > NS Record Report in WHM to see the nameservers and their public IP addresses. If they do not appear immediately, do not be alarmed, they will show up if you followed the steps correctly. It needs to propagate.

Now you can go to your registrar and point a domain to your two nameservers and wait for it to propagate. In Dynadot for example, since you have registered two private nameservers, they will automatically appear in the drop down menu showing the list of available nameservers to choose from.

Enjoy and good luck and feel free to comment here if you have any questions.



  1. This post and the one referenced by Rob Scott are very helpful to someone like me; running a VPS at GoDaddy and having a tough time paying through the nose every time I need another 20 or 30 GB of space and getting “virtually” no support (sorry for that.) I mean, if I’m not going to get any (or much) help and I’m going to have to figure it all out myself anyway, I may as well go to Amazon and have the added benefit of truly flexible space and bandwidth. The only roadblock to making the plunge (for me) was just not having a clue how to navigate the conundrum that is the AWS interface.
    Thanks for posting this…I can’t thank you enough.

    • Thanks for your comment and I’m glad to hear the guide proved to be useful.

      You are right about what you say. Just keep in mind that AWS is not managed so you won’t receive any support in regards to security or when something goes wrong. You will be pretty much on your own all the way.

      When you do setup Amazon EC2 and WHM, I highly recommend that you take the necessary security steps like installing ClamAV to run on a cron to scan the server for viruses or malicious scripts, etc. Another thing you can look at is Atomic Secured Linux.

      All the best and feel free to ask if you have any questions.

      • Yes, I’m aware of the pitfalls, especially for someone still learning the ropes. I plan to put only non-essential sites (basically a couple of my own sites) on AWS at first – and I might keep it this way for a while! And certainly not without all the protections I currently have in place on my VPS at GoDaddy.
        Thanks for the offer to answer questions, too. I might have to take you up on that.

  2. Hello,

    Thank you very much for this tutorial, Add Hostname entry in the private ip?.

    Best regards,

    Eugenio Carrió

  3. How much do you charge to set up the CloudLinux with cPanel on aws ec2?
    I’m trying, but I can not.

  4. Nice tutorial Antonie,

    I was able to set up WHM on CLoud Linux AWS

    I followed this instruction

    I Created my custom name servers at Godaddy and mapped it to my elastic ip adress on amazon ec2 maps to maps to

    During initial WHM setup i added my custom name server and i used the server ip as an A record.

    I created an account for a client / and successfully but i cant access the websites.

    I also get an error from – check DNS server and mail server health What exactly am i doing wrong ?

    When I check ns Record reports i get this error

    Would appreciate any help this point as my websites are down 🙁

  5. I got this error when resetting Failed to reset zone Unable to determine the IP address for

  6. I was looking to migrate from traditional dedicated servers to amazon from long time. But couldnt do due to lack of cpanel/whm install insturctions.
    This post helped me a lot.
    Thanks bro.

  7. When I submit a DNS request to asking for a domain, it returns a private IP address. What I doing wrong? 🙁

  8. Hi say I have assigned as the Private IP of my instance and my Elastic IP is My domain say points it’s A record at at the registrar Even if I stop my instance which is running Cloudlinux and WHM (CLOUDLINUX 6.6 x86_64 xenpv – server1 WHM 11.46.3 (build 1) ) the instance functionality wont allow me to create another private IP address (link deactivated).Regardless I am happy to use the nameservers at my Registrar say and who happen to be NameSilo.
    If my domain is and I add domains like and under Create Account in WHM all my sites redirect to the cpanel default page: etc… despite having an index.html file in their respective public_html. Using “Basic cPanel & WHM Setup” I set my IP to use instead of and reset the DNS zone but WHM hangs. What should the hostname of the server IP be given values above and what IP’s should I be using for the “Primary Resolver”. Some places state use and for Google and other reference an Amazon one 172…. or something OR should I be using IPs relating to my nameservers IP?
    Totally lost and would appreciate help.

  9. Hi,
    Have I become a registered user on cPanel to install WHM/cPanel in my instance no AWS?

    Does AWS offer any type of web service that come with WHM/cPanel installed??


  10. On more thing: MySQL, FTP Server, MailServer are installed with WHM/cPanel?

    I’m a VPS user for a lot of years but all of that VPS that I used came with WHM/cPanel, MySQL Server, FTP Server, MailServer, WebMail installed, so I´m afraid to make all of this configuration by myself.


    • Yes, WHM provides all the necessary services such as the web server (Apache), the pop/imap mail server (Dovecot), the smtp server (Exim), FTP server (PureFTP), etc… Some of these services have different options as well.

  11. Fernando Miranda

    June 10, 2015 at 12:51 pm

    First thank you and congratulations for the content, has helped me a lot, my installation is still not working, may I ask what information goes in Network Setup > Change Hostname > Current Hostname and also in Network Setup > Resolver Configuration > Primary Resolver and Secondary Resolve. There at the top’m having the information: CENTOS 7.1 x86_64 xenhvm – ip-10-0-0-4 WHM 11.50.0 (build 10) [TRIAL] Load Averages: 0.02 0.03 0.05 Secure Connection Secure Connection

    • Thank you, I’m glad to hear that the article helped you.

      I believe the hostname is automatically set by WHM during installation and it will resolve back to your nameservers that you configure.

      Why is your installation not working? What is wrong exactly?

      • Fernando Miranda

        June 10, 2015 at 1:58 pm

        When I was going on DNS Functions > NS Record Report was empty, but has just been completed, the Godaddy delay was 24 hours to propagate. In Network Setup > Change Hostname > Current Hostname is something like it? Network Setup > Resolver Configuration > Primary Resolver is with ip and Secondary Resolver is empty, is it anyway? I will point out the records of a customer, takes place ip`s Or only the names?

  12. Fernando Miranda

    June 12, 2015 at 12:35 pm

    Friend, when I point an account by the registrar for the dns whm returns the error timeout, the whm domain is registered with GoDaddy, I have to change anything else in the Godaddy DNS zone file?

    • No, there isn’t anything else you should have to do at GoDaddy other than register your two nameservers and point your domain to them.

      GoDaddy can be very slow with updating DNS records compared to other registrars though so I don’t recommend GoDaddy to anyone for this specific reason.

      We are our own registrar at Tribulant Software if you are interested in registering your domain with us: . The DNS updates are quick as well.

  13. I had an issue where Bind DNS was not responding to queries. I took a look at named.conf and had to change to allow queries. Now it works perfect. Thanks for your post.

  14. Antonie hello, nice post. correctly followed his instructions using 2 ips elastic, but my did not identify the dns, returns with error. Have any further configuration in aws?


  15. how can i add dedicated ips for ssl purposes from amazon to whm?

Leave a Reply

Your email address will not be published.


© 2021 Contrid

Theme by Anders NorénUp ↑

Pin It on Pinterest

%d bloggers like this: