How do I migrate an EC2-Classic instance to a VPC in same Region of same account?
Last updated: 2021-02-22
I have multiple Amazon Elastic Compute Cloud (Amazon EC2) instances in EC2-Classic. I want to migrate the EC2-Classic instances to a virtual private cloud (VPC) before EC2-Classic is no longer available. How can I do that?
You can use the AWSSupport-MigrateEC2ClassicToVPC Automation document to migrate your EC2-Classic instances to a VPC in same Region of the same AWS account.
Before using this Automation document, verify the service quotas for the following resources in the VPC:
- Elastic IP addresses
- EC2 instances
- Security groups
If necessary, increase the quotas before running the Automation. For more information about how to request a quota increase, see AWS service quotas.
Migrate an EC2-Classic instance to a VPC
- Open the AWS Systems Manager console, and then choose Automation from the navigation pane.
- Choose Execute automation.
- On the Owned by Amazon tab, in the Automation document search box, enter MigrateEC2Classic.
- Select the radio button for the AWSSupport-MigrateEC2ClassicToVPC document, and then choose Next.
- Under Input parameters, for InstanceId, enter your source EC2-Classic instance ID.
- For AutomationAssumeRole and TargetInstanceType, choose your required parameters. By default, TargetInstanceType is set to t2.xlarge.
Note: For more information about the IAM permissions that are required for AutomationAssumeRole to successfully run the Automation, see AWSSupport-MigrateEC2ClassicToVPC.
- (Optional) For DestinationSubnetId and DestinationSecurityGroupId, enter your subnet ID and VPC security group ID.
Note: If these fields are left blank, then the Automation selects a random subnet in the default VPC. Security groups that are attached to the source instance are copied to the VPC and used to launch the target instance.
- For MigrationType, select Test or CutOver.
- If you select CutOver for MigrationType , then set the following parameters:
SNSNotificationARNForApproval: Enter the ARN of the SNS topic used to send Approval notifications to stop the source instance.
ApproverIAM: Enter the ARN of the IAM users or roles that can approve or reject the action to stop the source instance.
- Choose Execute.