:doc:`NetworkInterface <index>` / Action / attach

******
attach
******



.. py:method:: EC2.NetworkInterface.attach(**kwargs)

  

  Attaches a network interface to an instance.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AttachNetworkInterface>`_  


  **Request Syntax**
  ::

    response = network_interface.attach(
        NetworkCardIndex=123,
        EnaSrdSpecification={
            'EnaSrdEnabled': True|False,
            'EnaSrdUdpSpecification': {
                'EnaSrdUdpEnabled': True|False
            }
        },
        EnaQueueCount=123,
        DryRun=True|False,
        InstanceId='string',
        DeviceIndex=123
    )
    
  :type NetworkCardIndex: integer
  :param NetworkCardIndex: 

    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.

    

  
  :type EnaSrdSpecification: dict
  :param EnaSrdSpecification: 

    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.

        

      
    
  
  :type EnaQueueCount: integer
  :param EnaQueueCount: 

    The number of ENA queues to be created with the instance.

    

  
  :type DryRun: boolean
  :param DryRun: 

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

    

  
  :type InstanceId: string
  :param InstanceId: **[REQUIRED]** 

    The ID of the instance.

    

  
  :type DeviceIndex: integer
  :param DeviceIndex: **[REQUIRED]** 

    The index of the device for the network interface attachment.

    

  
  
  :rtype: 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.

        
  