move_ec2_instance
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
move_ec2_instance [2017/07/26 17:33] – [Introduction] walkeradmin | move_ec2_instance [2017/07/26 20:30] – [Delete Old AMI] walkeradmin | ||
---|---|---|---|
Line 3: | Line 3: | ||
\\ | \\ | ||
\\ | \\ | ||
+ | <color # | ||
---- | ---- | ||
Line 23: | Line 24: | ||
\\ | \\ | ||
\\ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | In the example above it can be see that my <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | The reality is that we can't move the EC2 Instance, we need to make a copy, then use that to create a new EC2 instance in a different AZ. The new EC2 Instance will be an exact copy of the original, so everything will work exactly the same as it did before, only a little faster. | ||
+ | \\ | ||
+ | \\ | ||
+ | <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | To create an AMI, select the <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | From the pop out list select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | The Create Image page will open. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Enter the following information: | ||
+ | \\ | ||
+ | \\ | ||
+ | **Image name: | ||
+ | **Image description: | ||
+ | **No Reboot: | ||
+ | \\ | ||
+ | \\ | ||
+ | **Size GiB: | ||
+ | **Volume Type: | ||
+ | \\ | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | <color # | ||
+ | |||
+ | ---- | ||
+ | |||
+ | When you select the <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Just accept the message by selecting <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | The <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | \\ | ||
+ | For my EC2 Instance, the AMI creation took around 5 Minutes. I have an EC2 that has an 8Gb Magnetic store, this store is about 80% full. | ||
+ | \\ | ||
+ | \\ | ||
+ | After the AMI Creation is complete, the status will change to <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | This is the back process complete. | ||
+ | \\ | ||
+ | \\ | ||
+ | Next we need to make the AMI available in our new region (AZ). | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | The Copy AMI page will open. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | We have to make some initial choices here: | ||
+ | \\ | ||
+ | \\ | ||
+ | **Destination Region: | ||
+ | **Name: | ||
+ | \\ | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | A Copy AMI Confirmation window will open. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | This also took around 5 minutes to complete for my EC2 Instance. | ||
+ | \\ | ||
+ | \\ | ||
+ | Before you continue, it is very important to ensure that you are now working in the correct AZ (Availability Zone). | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | In the top right of the web interface, ensure you see your zone. | ||
+ | \\ | ||
+ | \\ | ||
+ | Before you continue, ensure that the status for the AMI is <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | when the AMI is available, select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | From the menu, select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | What launch does, it to take you through an identical process to when you create a new EC2 Instance. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Chose an instance type, select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | **Configure Instance Details.** | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Unless you have a good reason, there are no changes required here. Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | **Add Storage.** | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | I normally accept the defaults here, but I do change from SSD to Magnetic. Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | **Add Tags.** | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Nothing to do here, select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | **Configure Security Group** | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Here we have to open any ports that we were using for the instance we copied earlier. I was using port 80 as my EC2 Instance was a web server. | ||
+ | \\ | ||
+ | \\ | ||
+ | Add any relevant ports then select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | You will get a warning about storage. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Because we selected magnetic, we see this page. I have been using magnetic for a few weeks and have not yet incurred any costs. | ||
+ | \\ | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | After all the settings pages you will see a **confirmation page**. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | Because this is a new EC2 Instance, we need to create a new Key Pair. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | If you check the status of your EC2 Instance, you will see the following: | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | The Availability Zone (AZ) has now changed to the region you selected. Your IP will also have changed, as IPs can't be moved between AZs you will have to update your DNS settings, also if you use Elastic IP Addresses, you will have to recreate new ones for this AZ. | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== The Original EC2 Instance ==== | ||
+ | \\ | ||
+ | We didn't actually move the EC2 Instance, we simply made a backup, copied the backup to a new AZ and created a new EC2 Instance from that backup. | ||
+ | \\ | ||
+ | \\ | ||
+ | What this means is that the EC2 Instance that you originally had is still there, and if you left it running, it is still running and potentially costing you money. | ||
+ | \\ | ||
+ | \\ | ||
+ | From the dashboard, select the AZ where your original EC2 Instance was created (US East (Ohio) in my case.) | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | You can't see instances in different AZs on one page unfortunately, | ||
+ | \\ | ||
+ | \\ | ||
+ | So here we are, back at the original AZ where our original EC2 Instance is. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | We have to stop this instance for two reasons. It is using a server, so this is incurring a cost, yes we could just stop it and leave it BUT, it is also consuming hard disk space. Even worse is that we are using a lot of space now because of the copy process, consider this: | ||
+ | \\ | ||
+ | \\ | ||
+ | Original EC2 Instance is using..< | ||
+ | The AMI we created is using.....< | ||
+ | The AMI copy is using...........< | ||
+ | The new EC2 Instance is using...< | ||
+ | \\ | ||
+ | Total...........................< | ||
+ | \\ | ||
+ | \\ | ||
+ | Our free allowance is 30GB, so we need to do some cleaning up. | ||
+ | \\ | ||
+ | \\ | ||
+ | We need to do the following: | ||
+ | \\ | ||
+ | \\ | ||
+ | Stop the old EC2 Instance.\\ | ||
+ | Delete the old EC2 Instance.\\ | ||
+ | Delete the AMI Image.\\ | ||
+ | Delete the AMI Copy Image.\\ | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Stop the old EC2 Instance ==== | ||
+ | \\ | ||
+ | From the console, navigate to the old EC2 Instance. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | You will see a warning page about stopping an Instance. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | It might take a minute or two, but the instance will stop. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Keep checking the console until the instance status is <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ==== Delete old EC2 Instance ==== | ||
+ | \\ | ||
+ | To delete the old EC2 Instance, from the EC2 Console page. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | You will get a warning about terminating an instance. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | Check the status of your old EC2 to check termination is complete. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | This might take a minute to two. | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ==== Delete Old AMI ==== | ||
+ | \\ | ||
+ | Naviage back to the EC2 Console (ensure you are on your old AZ) | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | From the menu on the right, go down to <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | Your AMI will be listed in the main page. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | You will get a warning about deregistering an AMI. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | From the <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Select <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | From the <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | If you have more than one snapshot, ensure you select the correct one. | ||
+ | \\ | ||
+ | \\ | ||
+ | You will see a warning about deleting a snapshot. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{ : | ||
+ | \\ | ||
+ | Click <color # | ||
+ |
move_ec2_instance.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1