13.9. 使用 SSH 连接到 Amazon EC2 实例
您可以使用 SSH 从 Satellite 服务器远程连接到 Amazon EC2 实例。但是,若要连接到您通过 Red Hat Satellite 置备的任何 Amazon Web Services EC2 实例,您必须首先访问与 Foreman 数据库中计算资源关联的私钥,并使用此密钥进行身份验证。
流程
要找到计算资源列表,在 Satellite 服务器基础系统上输入以下命令,并记下您要使用的计算资源的 ID:
# hammer compute-resource list以
postgres用户身份连接到 Foreman 数据库:# su - postgres -c psql 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