Maximize network bandwidth on Amazon EC2 instances with multiple network cards
Many instances types that support EFA also have multiple network cards. For more information, see Network cards. If you plan to use EFA with one of these instance types, we recommend the following basic configuration:
-
For the primary network interface (network card index
0
, device index0
), create an EFA (EFA with ENA) interface. You can't use an EFA-only network interface as the primary network interface. -
For each additional network interface, use the next unused network card index, device index
1
, and either an EFA (EFA with ENA) or EFA-only network interface, depending on your usecase, such as ENA bandwidth requirements or IP address space. For example use cases, see EFA configuration for a P5 instances.
Note
P5 instances require network interfaces to be configured in a specific manner to enable maximum network bandwidth. For more information, see EFA configuration for a P5 instances.
The following examples show how to launch an instance based on these recommendations.
EFA configuration for a P5 instances
P5 instances have a total network bandwidth capacity of 3,200 Gbps, of which up to 800 Gbps can be utilized for IP network traffic. Because EFA and IP network traffic share the same underlying resources, bandwidth used by one will reduce the bandwidth that is available to the other. This means that you can distribute the network bandwidth between EFA traffic and IP traffic in any combination, as long as the total bandwidth does not exceed 3,200 Gbps and IP bandwidth does not exceed 800 Gbps.
Use case 1: Save IP addresses and avoid potential Linux IP issues
This configuration provides up to 3200 Gbps of EFA networking bandwidth and up to 100 Gbps of IP networking bandwidth with one private IP address. This configuration also helps to avoid potential Linux IP issues, such as disallowed auto-assignment of public IP addresses and IP routing challenges (hostname to IP address mapping issues and source IP address mismatches), that can arise if an instance has multiple network interfaces. For example, if you use 400 Gbps or IP bandwidth, you can achieve up to 2,800 Gbps of EFA bandwidth at the same time.
-
For the primary network interface (network card index 0, device index 0), use an EFA (EFA with ENA) network interface.
-
For the remaining network interfaces (network card indexes 1-31, device index 1), use EFA-only network interfaces.
Use case 2: Maximum EFA and IP network bandwidth
This configuration provides up to 3200 Gbps of EFA networking bandwidth and up to 800 Gbps of IP networking bandwidth with 8 private IP address. You can't auto-assign public IP addresses with this configuration. However, you can attach an Elastic IP address to the primary network interface (network card index 0, device index 0) after launch for internet connectivity.
-
For the primary network interface (network card index 0, device index 0), use an EFA (EFA with ENA) network interface.
-
For the remaining interfaces, do the following:
-
Specify EFA-only network interfaces on network card indexes 1, 2, and 3, and use device index 1.
-
Specify one EFA (EFA with ENA) network interface and three EFA-only network interfaces in each of the following network card index subsets, and use device index 0:
-
[4,5,6,7]
-
[8,9,10,11]
-
[12,13,14,15]
-
[28,29,30,31]
-
-
The following example illustrates this configuration:
$ aws --region $REGION ec2 run-instances \ --instance-type p5.48xlarge \ --count 1 \ --key-name key_pair_name \ --image-id ami_id \ --network-interfaces "NetworkCardIndex=0,DeviceIndex=0,Groups=
security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=1,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=2,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=3,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=4,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=5,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=6,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=7,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=8,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=9,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=10,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=11,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=12,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=13,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=14,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=15,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=16,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=17,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=18,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=19,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=20,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=21,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=22,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=23,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=24,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=25,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=26,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=27,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=28,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa" \ "NetworkCardIndex=29,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=30,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" \ "NetworkCardIndex=31,DeviceIndex=1,Groups=security_group_id
,SubnetId=subnet_id
,InterfaceType=efa-only" ...