How to Control Apache2 JMeter Server Remotely on AWS EC2 from Local JMeter Client Inside FW

Security Group

It is enough to open the port 22 at Security Group on EC2

SSH TCP 22 0.0.0.0/32

JMeter Server Configuration

cd apache-jmeter-3.0/bin
vi ./jmeter.properties

Find and modify the following two lines

server_port=10991             # Server-side port from JMeter client: JMeter Client -> JMeter Server
server.rmi.localport=40001    # Server port to access to Client via RMI: JMeter Server -> JMeter Client

NOTE: SSH tunneling technique via Port 22 is used to communicate in between JMeter client and JMeter server for those two ports (10991 and 40001)

Modify the 2nd JMeter server (e.g. jmeter-2) and the 3rd one (e.g. jmeter-3) as follows if you want to control three remote JMeter servers

server_port=10992             # Server-side port from JMeter client: JMeter Client -> JMeter Server
server.rmi.localport=40002    # Server port to access to Client via RMI: JMeter Server -> JMeter Client
server_port=10993             # Server-side port from JMeter client: JMeter Client -> JMeter Server
server.rmi.localport=40003    # Server port to access to Client via RMI: JMeter Server -> JMeter Client

Run JMeter Server

./jmeter-server -Djava.rmi.server.hostname=127.0.0.1

JMeter Client Configuration

cd apache-jmeter-3.0/bin
vi ./jmeter.properties

Find and modify the following two lines

# JMeter Server hosts/addresses information that a JMeter client uses
remote_hosts=localhost:10991,localhost:10992,localhost:10993

# The port to receive RMI request from JMeter server to JMeter client
client.rmi.localport=5000

NOTE: SSH tunneling technique via Port 22 is used to communicate in between JMeter client and JMeter server for those two ports (10991 and 40001)

How to Connect to JMeter Servers via SSH Tunnel

Create or edit ~/.ssh/config

vi ~/.ssh/config

Add the following

Host jmeter-1
  HostName        xxx.xxx.xxx.xxx # Server-side JMeter IP address (or hostname)
  IdentityFile    ~/.ssh/id_rsa
  User            root
  LocalForward    10991 localhost:10991
  LocalForward    10992 localhost:10992
  LocalForward    10993 localhost:10993
  LocalForward    40001 localhost:40001
  LocalForward    40002 localhost:40002
  LocalForward    40003 localhost:40003
  RemoteForward   5000  localhost:5000

Establish a tunnel from JMeter client to jmeter-1 (You don't have to connect jmeter-2 or jmeter-3since the above configuration includes both jmeter-2 and jmeter-3 tunneling settings)

ssh jmeter-1

Run JMeter Client

./jmeter.sh -Djava.rmi.server.hostname=127.0.0.1