How do I migrate an EC2-Classic instance to a VPC in same Region of same account?

2 minute read
0

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.

Resolution

You can use the AWSSupport-MigrateEC2ClassicToVPC Automation document to migrate your EC2-Classic instances to a VPC in the same Region of the same AWS account. The runbook supports only EC2-Classic instances with a virtualization type of HVM and a root volume type of EBS.

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.

Note: AWS is retiring EC2-Classic. For more information, see EC2-Classic Network is retiring - Here's how to prepare.

Migrate an EC2-Classic instance to a VPC

  1. Open the AWS Systems Manager console, and then choose Automation from the navigation pane.
  2. Choose Execute automation.
  3. On the Owned by Amazon tab, in the Automation document search box, enter MigrateEC2Classic.
  4. Select the radio button for the AWSSupport-MigrateEC2ClassicToVPC document, and then choose Next.
  5. Under Input parameters, for InstanceId, enter your source EC2-Classic instance ID.
  6. For AutomationAssumeRole and TargetInstanceType, choose your required parameters. By default, TargetInstanceType is set to t2.xlarge.
    Note:: For more information about the AWS Identity and Access Management (IAM) permissions that are required for AutomationAssumeRole to successfully run the Automation, see AWSSupport-MigrateEC2ClassicToVPC.
  7. (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.
  8. For MigrationType, select Test or CutOver.
  9. 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.
  10. Choose Execute.

Related information

Migrate from EC2-Classic to a VPC