qoomon / aws-ssm-ec2-proxy-command

AWS SSM EC2 SSH Proxy Command
MIT License
213 stars 73 forks source link

@codesync-dev could you move your question to a separate issue? #12

Closed codesync-dev closed 2 years ago

codesync-dev commented 2 years ago

@codesync-dev could you move your question to a separate issue?

Originally posted by @qoomon in https://github.com/qoomon/aws-ssm-ec2-proxy-command/issues/11#issuecomment-909898066

Hello, I wasn't sure where to ask this question.

With this github repository, how are you replacing the requirement to use a private key (access_key.pem for example) when establishing an SSH connection with an EC2 host? For instance, I typically have to run the command if I want to do a port forward from my local machine: ssh ec2-user@i-xxx-NL 5000:redis.cache.amazonaws.com:6379 -i access_key.pem -v

I would run the above command after running something like: aws ssm start-session --target i-xxx and I am able to do that because of the changes to my $HOME/.ssh/config file.

I'm looking to do away with requiring the use of a .pem file, if that is possible. I didn't see it in your ssh script, so just curious how that is being handled. Also, could you discuss why a public key is required to be uploaded?

qoomon commented 2 years ago

private key is defined within ~/.ssh/config

host i-* mi-*
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand ~/.ssh/aws-ssm-ec2-proxy-command.sh %h %r %p ~/.ssh/id_rsa.pub
  StrictHostKeyChecking no