Setup pi-hole ad filter server on AWS in 2 minutes


We assume you have an AWS account (if not get one here and you know the basics on how to start an instance in AWS (

  • Start an AWS server type in the region of your choice (they start at US$1 per month for spot instances. I use T3GA.NANO or T4G.NANO)
  • Open the right ports in the AWS security group (TCP 80, 53, 443, 4711 and UDP 53 at least for an IPv4 server). Of course only for your own IP addresses. DO NOT OPEN THE SERVER FOR ALL. YOUR MACHINE WILL BE ADBUSED VERY QUICKLY. (Some more info)
  • Use OS: Ubuntu 20.04 LTS
  • Assign fixed IP address (Elastic IP)
  • Log into the command line interface of your new server
  • Update with
    apt -y update && apt -y upgrade
  • reboot
  • Run
    curl -sSL | bash
  • Follow the guided installation process. Suggested settings are fine.
  • Take note of the admin password or change it with
    pihole -a -p
  • reboot
  • Ready to go
  • Assign the fixed public IP address to your computers as a DNS server and enjoy browsing with less ads (you can tweak pihole so it is even better at blocking the right stuff, but this is not a subject for this quick guide. Read )

The following is optional. You don’t need it, but I like to use my own caching name server. So I don’t have to use the public DNS servers. Reasoning for this is another discussion and I will not cover here. 

  1. Install the DNS server on your pihole server
    apt install bind9 bind9utils -y
  2. Edit named/bind configuration
    vim /etc/bind/named.conf.options
    It should read this
    options {
    directory "/var/cache/bind";listen-on-v6 { none; };
    recursion yes;
    allow-recursion { localhost; };
    listen-on port 6236 { localhost; };
    allow-query { localhost; };
    allow-transfer { none; };
    dnssec-validation no;
  3. You can check your configuration with:
    named-checkconf /etc/bind/named.conf.options
  4. Make Named/Bind start automatically
    systemctl enable --now named
  5. reboot
  6. Then log into the admin interface and go to Settings / DNS and add this:

    Disable the other DNS services. So you only use your own Caching DNS and click save. 
  7. Ready to go. 

And even more optional is the setup if a swap file, if you chose a server with little RAM. 

These instructions are very good.