There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DescribeVpcAttribute with a CLI
The following code examples show how to use DescribeVpcAttribute.
- CLI
-
- AWS CLI
-
To describe the enableDnsSupport attribute
This example describes the
enableDnsSupportattribute. This attribute indicates whether DNS resolution is enabled for the VPC. If this attribute istrue, the Amazon DNS server resolves DNS hostnames for your instances to their corresponding IP addresses; otherwise, it does not.Command:
aws ec2 describe-vpc-attribute --vpc-idvpc-a01106c2--attributeenableDnsSupportOutput:
{ "VpcId": "vpc-a01106c2", "EnableDnsSupport": { "Value": true } }To describe the enableDnsHostnames attribute
This example describes the
enableDnsHostnamesattribute. This attribute indicates whether the instances launched in the VPC get DNS hostnames. If this attribute istrue, instances in the VPC get DNS hostnames; otherwise, they do not.Command:
aws ec2 describe-vpc-attribute --vpc-idvpc-a01106c2--attributeenableDnsHostnamesOutput:
{ "VpcId": "vpc-a01106c2", "EnableDnsHostnames": { "Value": true } }-
For API details, see DescribeVpcAttribute
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example describes the 'enableDnsSupport' attribute.
Get-EC2VpcAttribute -VpcId vpc-12345678 -Attribute enableDnsSupportOutput:
EnableDnsSupport ---------------- TrueExample 2: This example describes the 'enableDnsHostnames' attribute.
Get-EC2VpcAttribute -VpcId vpc-12345678 -Attribute enableDnsHostnamesOutput:
EnableDnsHostnames ------------------ True-
For API details, see DescribeVpcAttribute in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example describes the 'enableDnsSupport' attribute.
Get-EC2VpcAttribute -VpcId vpc-12345678 -Attribute enableDnsSupportOutput:
EnableDnsSupport ---------------- TrueExample 2: This example describes the 'enableDnsHostnames' attribute.
Get-EC2VpcAttribute -VpcId vpc-12345678 -Attribute enableDnsHostnamesOutput:
EnableDnsHostnames ------------------ True-
For API details, see DescribeVpcAttribute in AWS Tools for PowerShell Cmdlet Reference (V5).
-