EC2 / Client / describe_vpc_attribute

describe_vpc_attribute#

EC2.Client.describe_vpc_attribute(**kwargs)#

Describes the specified attribute of the specified VPC. You can specify only one attribute at a time.

See also: AWS API Documentation

Request Syntax

response = client.describe_vpc_attribute(
    Attribute='enableDnsSupport'|'enableDnsHostnames'|'enableNetworkAddressUsageMetrics',
    VpcId='string',
    DryRun=True|False
)
Parameters:
  • Attribute (string) –

    [REQUIRED]

    The VPC attribute.

  • VpcId (string) –

    [REQUIRED]

    The ID of the VPC.

  • DryRun (boolean) – Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

Return type:

dict

Returns:

Response Syntax

{
    'VpcId': 'string',
    'EnableDnsHostnames': {
        'Value': True|False
    },
    'EnableDnsSupport': {
        'Value': True|False
    },
    'EnableNetworkAddressUsageMetrics': {
        'Value': True|False
    }
}

Response Structure

  • (dict) –

    • VpcId (string) –

      The ID of the VPC.

    • EnableDnsHostnames (dict) –

      Indicates whether the instances launched in the VPC get DNS hostnames. If this attribute is true , instances in the VPC get DNS hostnames; otherwise, they do not.

      • Value (boolean) –

        The attribute value. The valid values are true or false .

    • EnableDnsSupport (dict) –

      Indicates whether DNS resolution is enabled for the VPC. If this attribute is true , the Amazon DNS server resolves DNS hostnames for your instances to their corresponding IP addresses; otherwise, it does not.

      • Value (boolean) –

        The attribute value. The valid values are true or false .

    • EnableNetworkAddressUsageMetrics (dict) –

      Indicates whether Network Address Usage metrics are enabled for your VPC.

      • Value (boolean) –

        The attribute value. The valid values are true or false .

Examples

This example describes the enableDnsSupport attribute. This attribute indicates whether DNS resolution is enabled for the VPC. If this attribute is true, the Amazon DNS server resolves DNS hostnames for your instances to their corresponding IP addresses; otherwise, it does not.

response = client.describe_vpc_attribute(
    Attribute='enableDnsSupport',
    VpcId='vpc-a01106c2',
)

print(response)

Expected Output:

{
    'EnableDnsSupport': {
        'Value': True,
    },
    'VpcId': 'vpc-a01106c2',
    'ResponseMetadata': {
        '...': '...',
    },
}

This example describes the enableDnsHostnames attribute. This attribute indicates whether the instances launched in the VPC get DNS hostnames. If this attribute is true, instances in the VPC get DNS hostnames; otherwise, they do not.

response = client.describe_vpc_attribute(
    Attribute='enableDnsHostnames',
    VpcId='vpc-a01106c2',
)

print(response)

Expected Output:

{
    'EnableDnsHostnames': {
        'Value': True,
    },
    'VpcId': 'vpc-a01106c2',
    'ResponseMetadata': {
        '...': '...',
    },
}