Hours after switching the nameservers for a website from Namecheap to Amazon Route53 the new nameservers were not being used on my Mac, even after I purged the name servers on my Mac using the terminal command below then rebooting:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
I then accessed the site from another Mac on my wifi network and it worked fine.
I then tried accessing the site from my primary Mac using a VPN, and again it worked fine.
The difference, it turns out, was I was using Cloudflares 22.214.171.124 DNS on my primary Mac. As soon as I switched my Mac’s DNS to 126.96.36.199 the new site was accessible.
Side note: One BIG disadvantage of buying domains on Namecheap is there is no way to set the name servers during the purchase… the domain will start off using Namecheap’s DNS, and the TTL is pre-set to 30 minutes. So if you plan to host your DNS elsewhere, when you specify custom nameservers it will take a minimum of 30 minutes delay before your new nameserver takes effect. (And as noted above if you are using Cloudflare for your local machine’s network DNS, it can be hours.)