Modifying the DNS Attributes of a VPC

You can modify an attribute of a Virtual Private Cloud (VPC), either to enable or disable support for DNS servers, or to enable or disable DNS hostnames.

The DNS servers for the VPC are defined in a set of DHCP options. When you create a VPC, a default set of DHCP options is created and automatically associated with the VPC, but you can replace it with a custom set. For more information, see About DHCP Options.

Modifying the DNS Attributes of a VPC Using AWS CLI

To modify an attribute of a VPC, use the modify-vpc-attribute command following this syntax:

Request sample
$ aws ec2 modify-vpc-attribute \
    --profile YOUR_PROFILE \
    --vpc-id vpc-12345678 \
    --no-enable-dns-support \
    [--enable-dns-hostnames | --no-enable-dns-hostnames] \

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • vpc-id: The ID of the VPC.

  • (optional) enable-dns-support | no-enable-dns-support: If set to enable-dns-support, the DNS servers for the VPC resolve DNS hostnames for your instances to the corresponding IPs. If set to no-enable-dns-support, they do not.

  • (optional) enable-dns-hostnames | no-enable-dns-hostnames: If set to enable-dns-hostnames, instances launched in the VPC get DNS hostnames. If set to no-enable-dns-hostnames, they do not.

    You cannot modify both the DNS support attribute and the DNS hostnames attribute at the same time. To modify the two attributes, use two separate requests.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The specified attribute is modified.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.