用github的ssh key连接aws的instance

一、生成一对public/private的key

1.windows下puttygen.exe生成

puttygen.exe

public-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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容