attach_network_interface

attach_network_interface(**kwargs)

Attaches a network interface to an instance.

See also: AWS API Documentation

Request Syntax

response = client.attach_network_interface(
    DeviceIndex=123,
    DryRun=True|False,
    InstanceId='string',
    NetworkInterfaceId='string',
    NetworkCardIndex=123,
    EnaSrdSpecification={
        'EnaSrdEnabled': True|False,
        'EnaSrdUdpSpecification': {
            'EnaSrdUdpEnabled': True|False
        }
    }
)
Parameters
  • DeviceIndex (integer) --

    [REQUIRED]

    The index of the device for the network interface attachment.

  • 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 .
  • InstanceId (string) --

    [REQUIRED]

    The ID of the instance.

  • NetworkInterfaceId (string) --

    [REQUIRED]

    The ID of the network interface.

  • NetworkCardIndex (integer) -- The index of the network card. Some instance types support multiple network cards. The primary network interface must be assigned to network card index 0. The default is network card index 0.
  • 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 uses ENA Express. To specify this setting, you must first enable ENA Express.

Return type

dict

Returns

Response Syntax

{
    'AttachmentId': 'string',
    'NetworkCardIndex': 123
}

Response Structure

  • (dict) --

    Contains the output of AttachNetworkInterface.

    • AttachmentId (string) --

      The ID of the network interface attachment.

    • NetworkCardIndex (integer) --

      The index of the network card.

Examples

This example attaches the specified network interface to the specified instance.

response = client.attach_network_interface(
    DeviceIndex=1,
    InstanceId='i-1234567890abcdef0',
    NetworkInterfaceId='eni-e5aa89a3',
)

print(response)

Expected Output:

{
    'AttachmentId': 'eni-attach-66c4350a',
    'ResponseMetadata': {
        '...': '...',
    },
}