EC2.Client.
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
}
}
)
[REQUIRED]
The index of the device for the network interface attachment.
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.[REQUIRED]
The ID of the instance.
[REQUIRED]
The ID of the network interface.
Configures ENA Express for the network interface that this action attaches to the instance.
Indicates whether ENA Express is enabled for the network interface.
Configures ENA Express for UDP network traffic.
Indicates whether UDP traffic uses ENA Express. To specify this setting, you must first enable ENA Express.
dict
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': {
'...': '...',
},
}