更改密钥对EC2实例 [英] Change key pair for ec2 instance

查看:2095
本文介绍了更改密钥对EC2实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改密钥对在AWS管理控制台我的EC2实例?我可以停止实例,我可以创建新的密钥对,但我没有看到任何一个环节修改实例的密钥对。

How do I change the key pair for my ec2 instance in AWS management console? I can stop the instance, I can create new key pair, but I don't see any link to modify the instance's key pair.

推荐答案

下面是我做的,感谢埃里克·哈蒙德的博客文章:

Here is what I did, thanks to Eric Hammond's blog post:

  1. 停止正在运行的EC2实例
  2. 在分离了的/ dev / sda1的体积(姑且称之为容积A)
  3. 在开始新的t1.micro EC2实例,用我的新的密钥对
  4. 附加卷A到新的微实例,如的/ dev / xvdf (或的/ dev / SDF
  5. SSH到新的微实例,并安装卷A到的/ mnt / tmp目录
  6. 复制的〜/ .ssh / authorized_keys中 /mnt/tmp/home/ubuntu/.ssh/authorized_keys
  7. 注销
  8. 终止微实例
  9. 从它分离容积A
  10. 附加卷了一回主实例作为的/ dev / sda1的
  11. 启动主实例
  12. 在登录和以前一样,使用新的质子交换膜文件
  1. Stop the running EC2 instance
  2. Detach its /dev/sda1 volume (let's call it volume A)
  3. Start new t1.micro EC2 instance, using my new key pair
  4. Attach volume A to the new micro instance, as /dev/xvdf (or /dev/sdf)
  5. SSH to the new micro instance and mount volume A to /mnt/tmp
  6. Copy ~/.ssh/authorized_keys to /mnt/tmp/home/ubuntu/.ssh/authorized_keys
  7. Logout
  8. Terminate micro instance
  9. Detach volume A from it
  10. Attach volume A back to the main instance as /dev/sda1
  11. Start the main instance
  12. Login as before, using your new .pem file

就是这样。

这篇关于更改密钥对EC2实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆