Working with DNS attributes
In this section, you'll learn how to view and update the DNS attributes for your VPC through the console and the command line. We'll cover how to find the DNS hostnames associated with your EC2 instances and network interfaces. Knowing these hostnames is important for connecting to your resources. You'll also learn how to enable the two main DNS attributes for your VPC: "Enable DNS hostnames" and "Enable DNS resolution". These settings control whether your instances get public DNS hostnames and whether the Amazon DNS server can resolve your private DNS names. Configuring these attributes correctly is vital for ensuring seamless communication within your VPC.
View DNS hostnames for your EC2 instance
You can view the DNS hostnames for a running instance or a network interface using the Amazon EC2 console or the command line.
The Public DNS (IPv4) and Private DNS fields are available when the DNS options are enabled for the VPC that is associated with the instance. For more information, see DNS attributes in your VPC.
Instance
To view DNS hostnames for an instance using the console
Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/
. In the navigation pane, choose Instances.
Select your instance from the list.
-
In the details pane, the Public DNS (IPv4) and Private DNS fields display the DNS hostnames, if applicable.
To view DNS hostnames for an instance using the command line
You can use one of the following commands. For more information about these command line interfaces, see Working with Amazon VPC.
describe-instances (Amazon CLI)
Get-EC2Instance (Amazon Tools for Windows PowerShell)
Network interface
To view the private DNS hostname for a network interface using the console
Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/
. In the navigation pane, choose Network Interfaces.
Select the network interface from the list.
-
In the details pane, the Private DNS (IPv4) field displays the private DNS hostname.
To view DNS hostnames for a network interface using the command line
You can use one of the following commands. For more information about these command line interfaces, see Working with Amazon VPC.
describe-network-interfaces (Amazon CLI)
Get-EC2NetworkInterface (Amazon Tools for Windows PowerShell)
View and update DNS attributes for your VPC
You can view and update the DNS support attributes for your VPC using the Amazon VPC console.
To describe and update DNS support for a VPC using the console
Open the Amazon VPC console at https://console.amazonaws.cn/vpc/
. In the navigation pane, choose Your VPCs.
Select the checkbox for the VPC.
-
Review the information in Details. In this example, both DNS hostnames and DNS resolution are enabled.
-
To update these settings, choose Actions and then choose Edit VPC settings. Select or clear Enable on the appropriate DNS attribute and choose Save changes.
To describe DNS support for a VPC using the command line
You can use one of the following commands. For more information about these command line interfaces, see Working with Amazon VPC.
describe-vpc-attribute (Amazon CLI)
Get-EC2VpcAttribute (Amazon Tools for Windows PowerShell)
To update DNS support for a VPC using the command line
You can use one of the following commands. For more information about these command line interfaces, see Working with Amazon VPC.
modify-vpc-attribute (Amazon CLI)
Edit-EC2VpcAttribute (Amazon Tools for Windows PowerShell)