一、生成一对public/private的key
1.windows下puttygen.exe生成
puttygen.exepublic-key
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
2.linux下ssh-keygen
Generating a new SSH key
Open Terminal.Paste the text below, substituting in your GitHub email address.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
This creates a new ssh key, using the provided email as a label.
Generating public/private rsa key pair.
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
二、将public key拷到github的ssh keys中
1.进入github的settings:
settings.png
2.在左边选:
ssh and GPG.png
3.点new ssh keys,填title(随便)和public key的内容:
add ssh key.png
4、点add ssh key就可以了。
三、使用生成的ppk文件或id_rsa私钥来连bostion instance
ppk-ssh.png四、通过bostion instance连接目标instance
bostion是个跳板机,连接成功后再ssh <内网ip>就可以连到目标instance.
这里要注意一下,需要分配了权限,才能通过github连到aws ec2
网友评论