Skip to content

describe_vpc_attribute

describe_vpc_attribute(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    attribute: Optional[VpcAttributeName] = None,
    vpc_id: Optional[VpcId] = None,
    dry_run: Optional[Boolean] = None,
) -> DescribeVpcAttributeResult

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

Parameters:

  • attribute (Optional[VpcAttributeName], default: None ) –

    The VPC attribute.

  • vpc_id (Optional[VpcId], default: None ) –

    The ID of the VPC.

  • dry_run (Optional[Boolean], default: None ) –

    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.

Raises:

Examples:

To describe the enableDnsSupport attribute 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.

>>> client.describe_vpc_attribute(vpc_id='vpc-a01106c2', attribute='enableDnsSupport')
To describe the enableDnsHostnames attribute
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.
>>> client.describe_vpc_attribute(vpc_id='vpc-a01106c2', attribute='enableDnsHostnames')
Source code in docs_src/capo_ec2/_services/ec2.py
def describe_vpc_attribute(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    attribute: Optional[
        "capo_ec2.types.vpc_attribute_name.VpcAttributeName"
    ] = None,
    vpc_id: Optional["capo_ec2.types.vpc_id.VpcId"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.describe_vpc_attribute_result.DescribeVpcAttributeResult":
    """<p>Describes the specified attribute of the specified VPC. You can specify only one attribute at a time.</p>

    Args:
        attribute: <p>The VPC attribute.</p>
        vpc_id: <p>The ID of the VPC.</p>
        dry_run: <p>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 <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe the enableDnsSupport attribute
        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.

        >>> client.describe_vpc_attribute(vpc_id='vpc-a01106c2', attribute='enableDnsSupport')
        To describe the enableDnsHostnames attribute
        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.

        >>> client.describe_vpc_attribute(vpc_id='vpc-a01106c2', attribute='enableDnsHostnames')
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.describe_vpc_attribute_request.DescribeVpcAttributeRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.describe_vpc_attribute_result.DescribeVpcAttributeResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_vpc_attribute

        output, http_response = (
            capo_ec2._operations.amazon_ec2.describe_vpc_attribute.describe_vpc_attribute(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeVpcAttribute")
    )
    input_: capo_ec2.types.describe_vpc_attribute_request.DescribeVpcAttributeRequest = {}
    if attribute is not None:
        input_["attribute"] = attribute
    if vpc_id is not None:
        input_["vpc_id"] = vpc_id
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output