简体   繁体   English

将 AWS EC2 实例移动到另一个账户

[英]Move AWS EC2 Instance to another account

I created a Amazon AWS EC2 instance under my account and made an website/ftp on it, now a new partner wants to move the instance under his company account so his company can pay the bills.我在我的账户下创建了一个 Amazon AWS EC2 实例,并在上面制作了一个网站/ftp,现在一个新的合作伙伴想把这个实例转移到他公司的账户下,这样他的公司就可以支付账单了。

We can't change the instance IP because banks in the region are communicating with the server.我们无法更改实例 IP,因为该地区的银行正在与服务器通信。

How can I move the instance to a different account without having to change anything on the configuration?如何在不更改配置的情况下将实例移动到不同的帐户?

The short answer is: No, you cannot move an running instance from one account to another unless and ofcourse AWS Technical support has some magic available behind the curtains.简短的回答是:不,您不能将正在运行的实例从一个账户移动到另一个账户,除非 AWS 技术支持在幕后提供一些魔法。

You can However, Create an AMI from this instance and share this AMI with other users/account.但是,您可以从此实例创建 AMI 并与其他用户/帐户共享此 AMI。 refer: http://aws.amazon.com/articles/530参考: http : //aws.amazon.com/articles/530

To share or migrate EC2 instances from a source account to a target account follow these steps:要将 EC2 实例从源账户共享或迁移到目标账户,请执行以下步骤:

  1. Create a custom Amazon Machine Image (AMI) from the instance you want to share or migrate.从要共享或迁移的实例创建自定义 Amazon 系统映像 (AMI) Be sure to include all required EBS data volumes in the AMI.确保在 AMI 中包含所有必需的 EBS 数据卷。

    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.注意:存储在实例存储卷上的数据不会保留在 AMI 中,也不会位于您从 AMI 启动的实例的实例存储卷上。

  2. Share the AMI with the target account using either the EC2 console or the AWS Command Line Interface (CLI).使用 EC2 控制台或 AWS 命令​​行界面 (CLI) 与目标账户共享 AMI

  3. From the target account, find the AMI using the EC2 console or the AWS CLI.从目标账户中,使用 EC2 控制台或 AWS CLI 查找 AMI

  4. Launch a new instance from the shared AMI on the target account. 目标账户上的共享 AMI 启动新实例

    Note : The private IP address of VPC instances will be different in the new account, unless you specifically set them during launch.注意:VPC 实例的私有 IP 地址在新账户中会有所不同,除非您在启动时专门设置它们。

Related information相关信息

Source: Transfer Amazon EC2 Instance来源: 传输 Amazon EC2 实例

This is not possible.这是不可能的。

AWS Support does not have access to copy Amazon EC2 resources or manipulate any configuration options in AWS accounts. AWS Support 无权复制 Amazon EC2 资源或操作 AWS 账户中的任何配置选项。 You can't separate an AWS account from an Amazon.com account or transfer resources between AWS accounts.您不能将 AWS 账户与 Amazon.com 账户分开或在 AWS 账户之间转移资源。 It is possible to manually migrate Amazon EC2 resources from one account to another by completing the steps described here.通过完成此处描述的步骤,可以手动将 Amazon EC2 资源从一个账户迁移到另一个账户。

Source : https://aws.amazon.com/premiumsupport/knowledge-center/account-transfer-ec2-instance/来源: https : //aws.amazon.com/premiumsupport/knowledge-center/account-transfer-ec2-instance/

I'm working with several hundreds on EC2 instances in several AWS regions and accounts.我正在多个 AWS 区域和账户中处理数百个 EC2 实例。 You can move an EC2 instance to another AWS account, however, you can't move the Elastic IP and it will take up 16 steps with AWS CLI, if you want to migrate Tags and clone the Security Groups.您可以将 EC2 实例移动到另一个 AWS 账户,但是,如果您要迁移标签和克隆安全组,则不能移动弹性 IP,并且使用 AWS CLI 需要 16 个步骤。 I wrote a detailed post with the whole process at https://medium.com/@gmusumeci/how-to-move-an-ec2-instance-to-another-aws-account-e5a8f04cef21 .我在https://medium.com/@gmusumeci/how-to-move-an-ec2-instance-to-another-aws-account-e5a8f04cef21写了一篇关于整个过程的详细帖子。

there are more than 10 steps involved in doing the cloud move.进行云迁移涉及 10 多个步骤。 I would suggest you use Infrastructure as a Configuration (terraform and CloudFormation) or Infrastructure as a real code (pulumi and CDK)我建议你使用基础设施作为配置(terraform 和 CloudFormation)或基础设施作为真正的代码(plumi 和 CDK)

however if you want to give a go at a nice tool I found called KopiCloud .但是,如果您想尝试一下我发现的名为KopiCloud的好工具。 Please feel welcome to try it and leave your comments below.请随时尝试并在下面留下您的评论。 Is good if you need to move instances on a quick lift and shift scenario.如果您需要在快速提升和转移场景中移动实例,这很好。

You can re-think the design of having the banks in the region communicating to your servers via IP.您可以重新考虑让该地区的银行通过 IP 与您的服务器通信的设计。
If the banks communicate using DNS names, you have much more flexibility to move your servers around.如果银行使用 DNS 名称进行通信,则您可以更灵活地移动服务器。
You can also achieve improvements in high availability and resiliency by moving to DNS connections.您还可以通过移动到 DNS 连接来提高高可用性和弹性。

So a plan might be所以一个计划可能是

  • Setup a DNS record for your existing server为现有服务器设置 DNS 记录
  • Get the banks who connect to your server to connect via the DNS name让连接到您服务器的银行通过 DNS 名称连接
  • Setup your new server in the other account (other answers describe this)在其他帐户中设置您的新服务器(其他答案对此进行了描述)
  • Cut the banks over to your new server in the new account simply by updating the DNS record只需更新 DNS 记录,即可将银行转移到新帐户中的新服务器

I haven't tried load balancing across accounts, but that may be another option, which would give you HA as a bonus.我没有尝试过跨账户的负载平衡,但这可能是另一种选择,它会给你 HA 作为奖励。 By registering your current instance, and new instance in another account as targets with a load balancer and getting your clients to connect to the load balancer, you could cut over to the other account.通过将您的当前实例和另一个账户中的新实例注册为负载均衡器的目标并让您的客户端连接到负载均衡器,您可以切换到另一个账户。 The only part I haven't tried is registering targets in different accounts, but looks like this should be possible with an AWS Network Load Balancer我唯一没有尝试过的部分是在不同的账户中注册目标,但看起来这应该可以通过AWS 网络负载均衡器实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM