不同根账户之间实例的挪动其实不可能(这里是root 账户),唯一方便的办法就是从一个账户中做一个AMI image文件,并分享给另一个账户ID,
然后由另一个账户ID登录,到AMI区域中找到该文档,从文档中启动instance.
参考以下AWS的帮助文档,AWS的文档基本都比较清晰,只要找对的话。
To share or migrate EC2 instances from a source account to a target account, follow these steps:
-
Create a custom Amazon Machine Image (AMI) from the instance you want to share or migrate. Be sure to include all required EBS data volumes in the AMI.
Note: Data stored on instance store volumes isn't preserved in AMIs, and won't be on the instance store volumes of the instances that you launch from the AMI. - Share the AMI with the target account using either the EC2 console or the AWS Command Line Interface (CLI).
- From the target account, find the AMI using the EC2 console or the AWS CLI.
-
Launch a new instance from the shared AMI on the target account.
Note: The private IP address of VPC instances will be different in the new account, unless you specifically set them during launch.
有一点要注意的是:
在创建AMI的时候,最好把instance停掉,这样AMI不会有问题,我之前在running 状态下创建AMI,发现配置有问题,Instance无法正常启动,表现是 check status 显示 1/2 check passed (警告)
具体可以参考这个链接:
https://stackoverflow.com/<wbr>questions/42160224/ec2-1-2-<wbr>checks-passed