Skip to content

How to remove public ipv4 dns name of ec2

0

I want to remove public ipv4 dns name of my ec2 instances. those dns names are automatically generated in form of ec2-X-X-X-X.ap-northeast-2.compute.amazonaws.com even when I try to turn it off.

I turned my VPC's DNS hostname option off. Once I turn the option off, AWS EC2 instance list's public ipv4 dns name goes away.

however, when I do something like "nslookup <ip_of_instance>" on a terminal, it still shows the dns name which is supposed to be removed. even "nslookup <the_dns_name>" still works and shows the ec2 instance's ip.

I tried to remove and restart ec2 instances after changing configuration of vpc, but the problem keep happens.

I got some options in route53 named "Autodefined Reverse" for the vpc and disabled it too, but it had no effect on my usecase.

what can I do for this? any help will be appreciated

  • I am curious why you are so concerned with removing the DNS entries. I am not sure you will ever be able to remove these as they are part of the pool of IPs available to EC2. They should not however affect your use of the IPs. You can create your own DNS names that are relevant to you.

1 Answer
0

The reason why you are still seeing the DNS name even after turning off the VPC's DNS hostname option is because the DNS resolution is happening through the Amazon DNS server.

To resolve this issue, you can configure your DNS server to forward queries to the Amazon DNS server. This can be done by adding a DNS forwarder in your DNS server configuration.

Here's how you can do it:

  1. Open your DNS server configuration tool (e.g., PowerShell, BIND, etc.).

  2. Add a forwarder entry for the domain you want to resolve to the Amazon DNS server. For example, if you want to resolve "example.com" to the Amazon DNS server, you would add the following entry:

forwarder 8.8.8.8
  1. Save the configuration and restart your DNS server.

After configuring the DNS forwarder, all DNS queries for the specified domain will be forwarded to the Amazon DNS server, and the DNS name of your EC2 instances will no longer be visible.

EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.