Cloning an Amazon EC2 Instance

Today, I had to create a new an Amazon EC2 instance that will be used for beta testing. The quickest way to do this will be to clone the instance that is running the production web site. All the necessary software is already installed there. Fortunately, the process is quite easy.

First, a bit of detail about the instance that is running the production site. We will call it the source. It is EBS backed running Linux. Various software, including database is already installed and fully functioning there.

To clone an instance, you first create a new AMI (Amazon Machine Image) from the source instance. Then you launch a new instance using the AMI. For example, I could create multiple instances for testing from the same AMI created from the production web site. When you create the AMI, system will create a snapshot of the EBS volume used by the source instance. When you launch a new instance from the AMI, a new EBS volume is created from that backup.

Below are the basic steps for the entire process.

1. In the AWS management console, select your source instance.

2. From menubar, select Actions > Create Image (EBS AMI).

3. Enter a name for the AMI, such as “My Base AMI”. I didn’t need to change anything else for my simple purpose.

4. Click Yes, Create.

System will shutdown the source instance, create the new AMI and then reboot the source instance. This can take up to 10 minutes.

5. In the management console, click AMIs for the latest status of the newly created AMI. Wait for the status to become available.

5. Select the AMI and click Launch.

6. Choose the instance type. For beta testing, I chose a cheaper type. Then click Continue to complete the creation of the new instance. You can create as many instances as you want this way.

If you click Volumes, you will see that a new EBS volume is created for the new instance.

One thought on “Cloning an Amazon EC2 Instance

  1. Awesome and simple post. It would be great if you could post more stuff related to EC2.

    I am using Magento on AWS.

    I also use webmin but have trouble with email server setup😦

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s