EC2 / Client / describe_network_interface_attribute

describe_network_interface_attribute#

EC2.Client.describe_network_interface_attribute(**kwargs)#

Describes a network interface attribute. You can specify only one attribute at a time.

See also: AWS API Documentation

Request Syntax

response = client.describe_network_interface_attribute(
    Attribute='description'|'groupSet'|'sourceDestCheck'|'attachment'|'associatePublicIpAddress',
    DryRun=True|False,
    NetworkInterfaceId='string'
)
Parameters:
  • Attribute (string) – The attribute of the network interface. This parameter is required.

  • 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.

  • NetworkInterfaceId (string) –

    [REQUIRED]

    The ID of the network interface.

Return type:

dict

Returns:

Response Syntax

{
    'Attachment': {
        'AttachTime': datetime(2015, 1, 1),
        'AttachmentId': 'string',
        'DeleteOnTermination': True|False,
        'DeviceIndex': 123,
        'NetworkCardIndex': 123,
        'InstanceId': 'string',
        'InstanceOwnerId': 'string',
        'Status': 'attaching'|'attached'|'detaching'|'detached',
        'EnaSrdSpecification': {
            'EnaSrdEnabled': True|False,
            'EnaSrdUdpSpecification': {
                'EnaSrdUdpEnabled': True|False
            }
        }
    },
    'Description': {
        'Value': 'string'
    },
    'Groups': [
        {
            'GroupName': 'string',
            'GroupId': 'string'
        },
    ],
    'NetworkInterfaceId': 'string',
    'SourceDestCheck': {
        'Value': True|False
    },
    'AssociatePublicIpAddress': True|False
}

Response Structure

  • (dict) –

    Contains the output of DescribeNetworkInterfaceAttribute.

    • Attachment (dict) –

      The attachment (if any) of the network interface.

      • AttachTime (datetime) –

        The timestamp indicating when the attachment initiated.

      • AttachmentId (string) –

        The ID of the network interface attachment.

      • DeleteOnTermination (boolean) –

        Indicates whether the network interface is deleted when the instance is terminated.

      • DeviceIndex (integer) –

        The device index of the network interface attachment on the instance.

      • NetworkCardIndex (integer) –

        The index of the network card.

      • InstanceId (string) –

        The ID of the instance.

      • InstanceOwnerId (string) –

        The Amazon Web Services account ID of the owner of the instance.

      • Status (string) –

        The attachment state.

      • EnaSrdSpecification (dict) –

        Configures ENA Express for the network interface that this action attaches to the instance.

        • EnaSrdEnabled (boolean) –

          Indicates whether ENA Express is enabled for the network interface.

        • EnaSrdUdpSpecification (dict) –

          Configures ENA Express for UDP network traffic.

          • EnaSrdUdpEnabled (boolean) –

            Indicates whether UDP traffic to and from the instance uses ENA Express. To specify this setting, you must first enable ENA Express.

    • Description (dict) –

      The description of the network interface.

      • Value (string) –

        The attribute value. The value is case-sensitive.

    • Groups (list) –

      The security groups associated with the network interface.

      • (dict) –

        Describes a security group.

        • GroupName (string) –

          The name of the security group.

        • GroupId (string) –

          The ID of the security group.

    • NetworkInterfaceId (string) –

      The ID of the network interface.

    • SourceDestCheck (dict) –

      Indicates whether source/destination checking is enabled.

      • Value (boolean) –

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

    • AssociatePublicIpAddress (boolean) –

      Indicates whether to assign a public IPv4 address to a network interface. This option can be enabled for any network interface but will only apply to the primary network interface (eth0).

Examples

This example describes the attachment attribute of the specified network interface.

response = client.describe_network_interface_attribute(
    Attribute='attachment',
    NetworkInterfaceId='eni-686ea200',
)

print(response)

Expected Output:

{
    'Attachment': {
        'AttachTime': datetime(2015, 5, 21, 20, 2, 20, 3, 141, 0),
        'AttachmentId': 'eni-attach-43348162',
        'DeleteOnTermination': True,
        'DeviceIndex': 0,
        'InstanceId': 'i-1234567890abcdef0',
        'InstanceOwnerId': '123456789012',
        'Status': 'attached',
    },
    'NetworkInterfaceId': 'eni-686ea200',
    'ResponseMetadata': {
        '...': '...',
    },
}

This example describes the description attribute of the specified network interface.

response = client.describe_network_interface_attribute(
    Attribute='description',
    NetworkInterfaceId='eni-686ea200',
)

print(response)

Expected Output:

{
    'Description': {
        'Value': 'My description',
    },
    'NetworkInterfaceId': 'eni-686ea200',
    'ResponseMetadata': {
        '...': '...',
    },
}

This example describes the groupSet attribute of the specified network interface.

response = client.describe_network_interface_attribute(
    Attribute='groupSet',
    NetworkInterfaceId='eni-686ea200',
)

print(response)

Expected Output:

{
    'Groups': [
        {
            'GroupId': 'sg-903004f8',
            'GroupName': 'my-security-group',
        },
    ],
    'NetworkInterfaceId': 'eni-686ea200',
    'ResponseMetadata': {
        '...': '...',
    },
}

This example describes the sourceDestCheck attribute of the specified network interface.

response = client.describe_network_interface_attribute(
    Attribute='sourceDestCheck',
    NetworkInterfaceId='eni-686ea200',
)

print(response)

Expected Output:

{
    'NetworkInterfaceId': 'eni-686ea200',
    'SourceDestCheck': {
        'Value': True,
    },
    'ResponseMetadata': {
        '...': '...',
    },
}