If you’re looking for an easy way to copy ssh keys from a MacOs machine to a server working as a bastion host.
Before this I used to copy the pem file , ssh into the server and make a file with the copied text. Then use that key to ssh into a machine.
The way I do it now is ssh agent forwarding.
Before you ssh into a machine, enter this command:
$ssh-add -K yourkey.pem
You should see an output of “Identity added”
Now when you ssh into the Bastion Host, instead of the -i just do this:
$ ssh -A user@IPADRESS
Afeter you ssh into the Bastion. You should be able to ssh into a server inside a private subnet of the same VPC.