moving EC2 instances between subnets

0

hello there, is there any solution to use a Lambda function (with Python) to change the subnet of an ec2 instance? if yes, please provide a sample code. thank you.

1개 답변
0

Hi Aref,

it is currently not possible to move your EC2 instance to another subnet (or Availability Zone or VPC). Instead, you can create a new Amazon Machine Image (AMI) from the source instance to manually migrate the instance. You can find a detailed guide here: https://repost.aws/knowledge-center/move-ec2-instance

Regards, Ben

profile pictureAWS
전문가
답변함 3달 전
profile pictureAWS
전문가
검토됨 2달 전
profile picture
전문가
Steve_M
검토됨 3달 전
  • Correct. Think about it - the EC2 is provisioned with a private IP which is kept for the lift of the EC2. This IP is allocated according to the subnet into which the EC2 is provisioned. It's not possible to have another subnet with the same range in the same VPC.

    Also the EBS volume which the EC2 uses to boot will be provisioned in a specific AZ, so even if the EC2 instance were able to be moved to another AZ it would no longer be able to attach its root disk.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠