By Semir H.
This tutorial will show you how to use a new Key Pair with an existing Linux instance.
If you find this tutorial useful, please consider making a donation to support future work like this:
Problem:
You have an existing EBS (root device) based Instance with data on it that needs to be saved. The original Key Pair has been lost so you can’t log into the Linux Instance. You need to get to the data on the virtual machine.
Solution:
We’ll clone the running Instance and re-deploy it but with a new Key Pair. We can either use a pre-made Pair or create a Pair while we’re re-deploying. My example uses Ubuntu but should apply to other flavours as well.
Creating an Image:
Log into your Amazon Web Services (AWS) Management Console, go to Amazon EC2, pick the Region where the Instance in question is running and click on the Instances link. Right click on the Instance in question and select “Create Image (EBS AMI)” from the resulting menu.
Give it a Image Name and a Description and click on “Create This Image” button. Example:
The process will now begin. Close the notification window.
Once the AMI is created (won’t take long) you should see it in the "Images" - "AMIs" part of your Amazon EC2 AWS Management Console. Please make sure you are still in the correct Region. Example:
Creating new Instance out of the new AMI:
Go to Images AMIs, locate your recently created AMI, right-click on it and select “Launch Instance” from the resulting menu.
Follow the prompts to finish creating the Instance (see my previous post) but make sure you select the correct Key Pair (one you create earlier, not the lost one) in the “Create Key Pair” section. Example:
All other settings should be the same as for the original Instance.
After a little bit of time your new Instance should be up and running.
Here’s an example below. Please note the different Key Pairs.
You can now connect to it, using your new private key, and confirm that all your data is still there.
Once you confirm no data is missing you can stop the old Instance and eventuality terminate it (after making absolutely sure you will never need anything from it).
Cleaning Up:
You can now de-register the AMI (unless you want to use later again).
You should also go to EBS - Snapshots and delete the Snapshot of the disk that was created when the AMI was made (unless you intend to use it for something in the future).
Information Technology HOWTOs, Technical Solutions, Best Practices and general cool stuff.
Showing posts with label key pairs. Show all posts
Showing posts with label key pairs. Show all posts
Thursday, July 28, 2011
Wednesday, July 27, 2011
Creating a Key Pair to share between AWS EC2 Instances
By Semir H.
If you find this tutorial useful, please consider making a donation to support future work like this:
Sign into Amazon Web Services Console. Go to the Amazon EC2 tab.
Pick your desired Region as this is where the key will be stored.
Locate the “Key Pairs” link under Networking & Security section and click on it.
Click on “Create Key Pair” button on the top to start the process.
Give the Key Pair a name. E.g. APAC-Keys-2011. Click on “Create”.
The Key Pair will be created and you will be prompted to save the private portion (a .pem file) on your computer/device. Please do so and make sure you keep it private,
You can now use this Key Pair for your new Instances. Please pick the “Choose from your existing Key Pairs” at the “Key Pairs” option when creating an Instance and select your pre-made Key Pair. Example below:
If you find this tutorial useful, please consider making a donation to support future work like this:
Sign into Amazon Web Services Console. Go to the Amazon EC2 tab.
Pick your desired Region as this is where the key will be stored.
Locate the “Key Pairs” link under Networking & Security section and click on it.
Click on “Create Key Pair” button on the top to start the process.
Give the Key Pair a name. E.g. APAC-Keys-2011. Click on “Create”.
The Key Pair will be created and you will be prompted to save the private portion (a .pem file) on your computer/device. Please do so and make sure you keep it private,
You can now use this Key Pair for your new Instances. Please pick the “Choose from your existing Key Pairs” at the “Key Pairs” option when creating an Instance and select your pre-made Key Pair. Example below:
Subscribe to:
Posts (Atom)









