aws / aws-ec2-instance-connect-cli

This is an all-in-one client for EC2 Instance Connect that handles key brokerage and establishing connection to EC2 Instances through an interface near-identical to standard system ssh, sftp, and other utilities.
Apache License 2.0
160 stars 42 forks source link

Configuration like ~/.ssh/config #4

Open KevinGimbel opened 5 years ago

KevinGimbel commented 5 years ago

By using the ~/.ssh/config file on my PC, ssh can be configured to allow easy and quick connections to remote servers by simply typing a hostname, e.g. ssh my-server-1 and all configuration is taken from the ~/.ssh/config file.

I would like to have a similar way to configure mssh so that I could just do mssh my-server-2 and the ID, username, and profile is taken from the config file. The syntax could be the same, e.g.

# ~/.mssh/config
Host my-server-2
  User ubuntu
  Id i-04be40ce96fd3f85
  Profile my-profile
  AvailabilityZone eu-central-1b
  Region eu-central-1b

As we have a quite a lot of servers this is a function I am missing at the moment compared to using SSH directly.

mswezey23 commented 4 years ago

Any word on this?

CptTZ commented 4 years ago

Any word on this?

This feature request is already in our backlog. I will update here once we have more info on it.

lkolchin commented 4 years ago

To expand on that. It'd be nice to even use the same ssh config file or at least being able to script SSH via SSM tunneling similar to:

Host *
TCPKeepAlive yes
ServerAliveInterval 30
ConnectTimeout 10

host i-*.* mi-*.*
  ProxyCommand bash -c "aws ssm start-session --target $(echo %h|cut -d'.' -f1) --region $(echo %h|/usr/bin/cut -d'.' -f2) --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
  User ec2-user
host i-* mi-*
  ProxyCommand bash -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
  User ec2-user

Then you would just:

mssh ec2-user@i-0ded1d8c2282ee39e.ap-southeast-2

or

mssh i-0ded1d8c2282ee39e.ap-southeast-2
Maks3w commented 3 years ago

Take a look to this implementation of ssh_config. I think you can do your changes for provide the region, etc as extra arguments to the aws-proxy script.

https://gist.github.com/Maks3w/de72b0160d5e6af958adc42eab014624

Imoustak commented 3 years ago

any news regarding this?

AgnibhaB commented 2 years ago

Any update on this.. This is a feature that I'm eagerly waiting