Interesting points,1.exeptional behaviour of amazon linux,2inbound rules 3.iperf options
Check the below link for guidance due to exceptional behaviour of amazon linux
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/
Amazon Linux
Amazon Linux 2:
Install the EPEL release package for RHEL 7 and enable the EPEL repository.
sudo amazon-linux-extras install epel -y
Amazon Linux Amazon Machine Image (AMI):
The EPEL repository is already installed on the original version of Amazon Linux, but you must enable it. You can enable this repository either by using the yum-config-manager command or by editing the epel.repo file.
sudo yum-config-manager --enable epel
sudo yum install iperf
These two instances are in the same vpc and security group.
Also in the security group add an inbound rule to allow tcp traffic between member of this group
then:
from node1 run iperf as client
[ec2-user@ip-172-31-88-129]$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 128 KByte (default)
------------------------------------------------------------
[ 4] local 172.31.88.129 port 5001 connected with 172.31.80.251 port 37922
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.0 sec 1.16 GBytes 999 Mbits/sec
from node2 run iperf as server using node2 private ip
[ec2-user@ip-172-31-80-251 ~]$ iperf -c 172.31.88.129
------------------------------------------------------------
Client connecting to 172.31.88.129, TCP port 5001
TCP window size: 715 KByte (default)
------------------------------------------------------------
[ 3] local 172.31.80.251 port 37922 connected with 172.31.88.129 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.16 GBytes 1.00 Gbits/sec
The result is 1GBit/sec!!