更改密钥对EC2实例

编程入门 行业动态 更新时间:2024-10-26 02:25:29
本文介绍了更改密钥对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:

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

    更多推荐

    更改密钥对EC2实例

    本文发布于:2023-08-07 14:11:09,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1319530.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:密钥   实例

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!