How do I export a Lightsail instance running Linux to Amazon EC2?
Last updated: 2019-10-10
I have an Amazon Lightsail instance running 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. How do I do that?
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.
3. Open the Snapshots tab, and then expand the drop-down menu for your instance.
4. Open the snapshot menu, and then select Export to Amazon EC2.
5. Review the information in the dialog box, and then choose Yes, Continue.
6. Review the information in the dialog box, and then choose Acknowledged.
Note: The export can be lengthy, depending 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. After the snapshot is exported, open the Lightsail Task Monitor menu, and then select Open the Amazon EC2 console. The snapshot is stored as an Amazon Machine Image (AMI) in the Amazon EC2 console.
Note: Don't select Create a new Amazon EC2 instance on the Lightsail Task Monitor menu. Open the Amazon EC2 console to create the instance as described in the Create an Amazon EC2 instance from a Lightsail snapshot section of this article. 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. Create the instance manually from the Amazon EC2 console to be sure of SSH key pair consistency.
Keep your Lightsail instance until your new solution on Amazon EC2 is up and running. Delete your Lightsail instance when no longer needed to avoid unnecessary charges.
After exporting the Lightsail instance to Amazon EC2, you can 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 so that you can easily identify it later.
5. Choose Launch.
6. Create a new key pair and download the private key file.
7. Choose Launch instances.
8. After your instance is running, connect to the instance using SSH.
9. Open the ~/.ssh/authorized_keys in a text editor, and then remove the "LightsailDefaultKeyPair" from the file.
Troubleshoot or recover data from a Lightsail snapshot using an Amazon EC2 instance
2. Launch a new Amazon EC2 instance in the same availability zone as your Lightsail instance. The new instance is your rescue instance.
4. Connect to the new instance using SSH and run the following command:
sudo mount /dev/sdf1 /mnt
Important: Replace sdf1 with the appropriate device name depending on your instance type and distribution. You can adjust the mount point (/mnt) if you prefer 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.