Following AWS best practices I’ve set up an infrastructure to which I ssh via a bastion box:
localhost → bastion → target server
To connect to the target server I have keyfiles on localhost and the bastion box, and then I use ssh to hop as follows:
localhost > ssh -i key.pem bastion bastion > ssh -i key.pem target
It looks like this question is related. How do I execute a command on the target server from localhost directly?