How do I export a Lightsail instance that runs Linux to Amazon EC2?

3 minute read
1

I have an Amazon Lightsail instance that runs Linux. I want to export the instance to Amazon Elastic Compute Cloud (Amazon EC2) so I can troubleshoot it or use advanced Amazon EC2 features.

Resolution

Note: IP addresses can't be transferred from Lightsail to Amazon EC2. Amazon EC2 instances that are created from exported Lightsail instances have a different IP address.

Export a Lightsail instance to Amazon EC2

  1. Sign in to the Lightsail console.
  2. Create a snapshot of the instance.
  3. Open the Snapshots tab. Then, expand the dropdown list for your instance.
  4. Open the snapshot menu. Then, select Export to Amazon EC2.
  5. Review the information in the dialog box. Then, choose Yes, Continue.
  6. Review the information in the dialog box. Then, choose Acknowledged.
    Note: The export can large, based on the size and configuration of the source instance or block storage disk. Use the Lightsail Task Monitor to track the status of the export.
  7. Open the Lightsail Task Monitor menu. Then, select Open the Amazon EC2 console. The snapshot is stored as an Amazon Machine Image (AMI) in the Amazon EC2 console.
    Note: Access the Amazon EC2 console to create the instance as outlined in the following section of this article. Don't use the Create a new Amazon EC2 instance on the Lightsail Task Monitor menu. Instances created from the Lightsail console always display the Lightsail key in the Amazon EC2 console, even if the Lightsail key is removed from the instance.

Keep your Lightsail instance until your new solution on Amazon EC2 is active. To avoid unnecessary charges, delete your Lightsail instance when no longer needed.

Use the exported snapshot to create a new Amazon EC2 instance, troubleshoot issues, or recover data.

Create an Amazon EC2 instance from a Lightsail snapshot

  1. In the Amazon EC2 console, open the AMIs pane.
  2. Select the AMI associated with the Lightsail snapshot that you created.
  3. Choose Launch.
  4. Follow the steps in the Amazon EC2 instance creation wizard.
    Note: In step 5 of the wizard, create a tag for the instance.
  5. Choose Launch.
  6. Create a new key pair and download the private key file.
  7. Choose Launch instances.
  8. Connect to the instance with SSH.
  9. Open the ~/.ssh/authorized_keys in a text editor. Then, remove the "LightsailDefaultKeyPair" from the file.

Troubleshoot or recover data from a Lightsail snapshot with an Amazon EC2 instance

  1. Create a new Amazon EBS volume from your Lightsail snapshot.
  2. Launch a new Amazon EC2 instance in the same Availability Zone as your Lightsail instance. The new instance is your rescue instance.
  3. Attach the new Amazon EBS volume to the rescue instance.
  4. Connect to the new instance with SSH and run the following command:
    sudo mount /dev/sdf1 /mnt
    Important: Replace sdf1 with the appropriate device name for your instance type and distribution. You can modify the mount point (/mnt) for another path. Be sure that the path is not already in use. For Nitro instances, use the device name /dev/nvme1n1p1. For previous generation instances, use the device name /dev/xvdf1.
  5. Use the rescue instance to troubleshoot or recover data.

Related information

Amazon EC2 Update - additional instance types, Nitro System, and CPU options

Elastic IP addresses

Elastic Load Balancing

Routing traffic to an Amazon EC2 instance

AWS OFFICIAL
AWS OFFICIALUpdated 2 months ago