14.9. 使用 SSH 连接到 Amazon EC2 实例
您可以使用 SSH 从 Satellite 服务器远程连接到 Amazon EC2 实例。但是,要连接到您通过 Red Hat Satellite 置备的任何 Amazon Web Services EC2 实例,您必须首先访问与 Foreman 数据库中计算资源关联的私钥,并使用此密钥进行身份验证。
流程
要找到计算资源列表,请在 Satellite 服务器基础系统上输入以下命令,并记录您要使用的计算资源的 ID:
# hammer compute-resource list将用户切换到
postgres用户:# su - postgres启动
postgresshell:$ psql以
postgres用户身份连接到 Foreman 数据库:# postgres=# \c foreman从
compute_resource_id = 3的key_pairs中选择 secret:# select secret from key_pairs where compute_resource_id = 3; secret-
在
-----BEGIN RSA PRIVATE KEY-----后复制密钥,直到-----END RSA PRIVATE KEY-----。 创建一个
.pem文件,并将您的密钥粘贴到文件中:# vim Keyname.pem确保限制对
.pem文件的访问:# chmod 600 Keyname.pem要连接到 Amazon EC2 实例,请输入以下命令:
ssh -i Keyname.pem ec2-user@example.aws.com