我正在尝试使用eb cli实用程序(版本3.8.7)尝试SSH到我的ElasticBeanstalk受pipe实例。
这些实例只有私有IP地址,并使用VPN连接到VPC。
当我运行命令eb ssh时,它试图连接到本地DNS无法parsing的专用DNS域
$ eb ssh -n 1 INFO: Attempting to open port 22. INFO: SSH port 22 open. INFO: Running ssh -i /Users/dkotvan/.ssh/qa-cert [email protected] ssh: Could not resolve hostname ip-xxx-xxx-xxx-xxx.ec2.internal: nodename nor servname provided, or not known
有没有办法将eb cli工具configuration为使用本地ip地址?
据我所知,绝对没有办法告诉eb cli你想连接到一个私有ip或者内部的dns。 主要的问题是,它们在一个私有子网上,而且实际上没有使用另一个可公开访问的主机的连接方式。 我可以通过连接到与我的EB环境相同的VPC的堡垒主机来解决这个问题。 使用堡垒主机是相当标准的做法,所以希望你已经有一个! 所以真的这只是一个〜/ .ssh / config的问题:
Host aws-bastion Hostname xxx.xxx.xxx.xxx #bastion public IP User your-bastion-user IdentityFile ~/.ssh/your-aws-key.pem Port 22 # or, a non-standard port if you configured it ForwardAgent yes Host *.ec2.internal IdentityFile ~/.ssh/your-aws-key.pem ProxyCommand ssh -q aws-bastion nc %h 22
你可以在你的.ssh/config文件中设置一个别名,如下所示:
Host ip-xxx-xxx-xxx-xxx.ec2.internal Hostname yyy.yyy.yyy.yyy