Macos 您能解释一下配置文件(mac os)中使用ssh连接到AWS实例的每个元素的含义吗

Macos 您能解释一下配置文件(mac os)中使用ssh连接到AWS实例的每个元素的含义吗,macos,amazon-web-services,ssh,Macos,Amazon Web Services,Ssh,我是AWS服务的新手。现在,我在AWS中启动了一个名为retest_den01的实例。我想用ssh(mac os)连接它。我有一个配置文件,如下所示。您能告诉我如何在AWS中获取主机吗?host和HostName有什么区别。另外,ProxyCommand ssh-W%h:%p gateway的含义 Host gateway HostName 54.199.245.48 User ec2-user IdentityFile ~/.ssh/ei-d.pem ServerAliveIn

我是AWS服务的新手。现在,我在AWS中启动了一个名为retest_den01的实例。我想用
ssh
(mac os)连接它。我有一个配置文件,如下所示。您能告诉我如何在AWS中获取主机吗?
host
HostName
有什么区别。另外,
ProxyCommand ssh-W%h:%p gateway
的含义

Host gateway
  HostName 54.199.245.48
  User ec2-user
  IdentityFile ~/.ssh/ei-d.pem
  ServerAliveInterval 120

Host rmtest_den01
  HostName 172.31.19.179
  User ec2-user
  IdentityFile ~/.ssh/ei-cloud.pem
  ProxyCommand ssh -W %h:%p gateway
  ServerAliveInterval 120
  StrictHostKeyChecking no
  UserKnownHostsFile=/dev/null
  LocalForward 30383 localhost:30383  

所有这些都在
ssh\u config
的手册页面中进行了精确的解释(很好的开始阅读!)。但是,报告提出了相应的问题:

你能告诉我如何在AWS中找到主机吗

ssh rmtest\u den01
应该将您带到您的实例

Host
HostName

`Host是条件块的开始,仅当您在命令行上使用的主机与该选项旁边的值匹配时才进行计算

HostName
是客户端要连接到的实际IP地址或主机名

另外,
ProxyCommand ssh-W%h:%p gateway
的含义

Host gateway
  HostName 54.199.245.48
  User ec2-user
  IdentityFile ~/.ssh/ei-d.pem
  ServerAliveInterval 120

Host rmtest_den01
  HostName 172.31.19.179
  User ec2-user
  IdentityFile ~/.ssh/ei-cloud.pem
  ProxyCommand ssh -W %h:%p gateway
  ServerAliveInterval 120
  StrictHostKeyChecking no
  UserKnownHostsFile=/dev/null
  LocalForward 30383 localhost:30383  
这意味着您不能直接从公共internet连接到主机IP,而只能通过中间服务器
网关
,其配置如上所述

请参阅我的编辑。缩进并不重要,但有助于理解什么与什么相关