title: Port forwarding to avoid the need for certificate
body: <p>I need to setup locally a tool that connects to the EC2 instance through SSH to perform profiling on the remote machine. The problem is the following: EC2 requires to use of a PEM certificate to connect, but the tool does not support certificates. Is there a way to do some port-forwarding so that the tool can connect to something like localhost:2222 without password (or at least without certificate) and then the traffic gets redirected to the EC2?</p>
  <p>I don't know exactly what ports are used by the tool, but for sure it can tunnel all traffic through SSH.</p>
  <p>If you need more info, the tool is the Nvidia Nsight Compute.</p>
  <p>I tried
  <code>sh -L 2222:localhost:22 -i mycertificate.pem &lt;username_ec2&gt;@&lt;ip_ec2&gt;</code>
  but then <code>ssh &lt;username_ec2&gt;@localhost:2222</code> returns <code>ssh: Could not resolve hostname localhost:2222: nodename nor servname provided, or not known</code>.</p>