由网友(颜值超标)分享简介:如何更改密钥对在AWS管理控制台我的EC2实例?我可以停止实例,我可以创建新的密钥对,但我没有看到任何一个环节修改实例的密钥对。How do I change the key pair for my ec2 instance in AWS management console? I can stop the inst...
如何更改密钥对在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
就是这样。
相关推荐
最新文章