At KnackForge, besides Development Services we assist Clients to setup server and take the responsibility of ensuring that their sites and servers are running smooth without any (or least) securely compromise.
We have tried different hosting providers ranging from shared host like bluehost to fully managed infrastructure providers like Amazon Web Services (AWS). AWS has been the best of our choices this far and we prefer the same for hosting clients site.
While this blog title say moving of instance, technically we are not moving the instance, instead we are creating a snapshot of existing server (in the form of AMI) and with the same we setup a new instance in different account. The steps involved in this process has been explained in this post.
What is Amazon AMI?
An Amazon Machine Image (AMI) is a special type of pre-configured operating system and virtual application software which is used to create a virtual machine within the Amazon Elastic Compute Cloud (EC2). It serves as the basic unit of deployment for services delivered using EC2.
See https://aws.amazon.com/amis for more details about it.
Login to AWS console of account from which you want to move the instance, navigate to "Instances" pane. Right click on the instance to be moved and choose "Create Image (EBS AMI)". Once done, you will receive a status message saying that request received and being processed to create image.
Navigation Pane in AWS Console
Menu we see on right clicking in the instance
Now check the "AMI" pane. You will see an AMI being created, when the status turns from "Pending" to "Available". You need to edit its permissions to be able to use from another AWS account.
Popup to change AMI permission
Enter the account id of the AWS account to which you want to expose this AMI. To find the account id; See "My Account / console > Security Credentials".
Now switch to the another account's AWS console. Navigate to "Instances" pane. Click the "Launch Instance" button, follow "Classic wizard", in the "Community AMIs" tab, search by entering the AMI id. A sample id will look like "ami-abcd1234".
Tip: If for some reason you couldn't get the AMI listed in search result, try repeating the steps again or change the AMI permission to Public at the worst case.
Once the AMI is listed, you could follow on from here with the usual steps of Launching instance. In a few minutes you will have your server up and running.
In my case the instance i had to move had a Web server running Drupal site powered by Ubuntu.
As a follow up of this process, I had to open up the http, ssh and other needed ports. Also had to create an Elastic IP and bind the same to newly Launched instance.
Finally from domain registrar admin panel I had to change the DNS settings to use the new Elastic IP.
With this approach in a less than a couple of hours I was able to get my server switched form one account to another and start running as expected with least down time.