Adding an EC2 Account

EC2 is different from other virtualization systems supported by Cloudmin, as it is a hosted service run by Amazon on their machines. They charge by the hour of machine time, and also for storage of any machine images that you create and host on their S3 service.

Cloudmin can manage virtual systems running under EC2 in almost exactly the same way as it does for other virtualized systems. The biggest difference is that they cannot be shut down without losing the contents of the system, which makes them a little risky for web hosting, as Amazon gives no guarantees of the stability of EC2 instances. Fortunately, Virtualmin makes it easy to backup hosted domains to Amazon's S3 service, which is fast and cheap when accessed from EC2 instances.

Signing Up With Amazon

The first step in the process of using EC2 is to sign up for an account at Amazon's website, http://aws.amazon.com/ . You will need to provide credit card details for billing. If you already have an Amazon account, adding the EC2 service to it is simple.

Once you have an account, you will need to find out the account number, access key and secret key. This can be done by :

  1. Go to http://aws.amazon.com/ , and mouse over the Your Web Services Account button on the right. In the window that pops up, click on AWS Access Identifiers.
  2. The access key is shown under Your Access Key ID . The secret is shown under Your Secret Access Key, when you click the Show link.
  3. Mouse over Your Web Services Account again, and click on Account Activity.
  4. At the top of the page is your Account Number .

Adding Your Account to Cloudmin

Once you have found your EC2 account number, access key and secret key, the account can be registered with Cloudmin. The steps to do this are :

  1. On the left menu, open the Cloudmin Settings section and click on EC2 Accounts.
  2. Click on the Add an EC2 account link.
  3. On the page that appears, enter a short name for this account in the Account description field, such as Bob's EC2 service.
  4. Fill in the Account ID, Access key ID and Secret access key fields with the account details retrieved from Amazon.
  5. Click the Create button.

Assuming that the account details are correct, you will be returned to the list of registered accounts. At the same time, Cloudmin will contact the Virtualmin webserver to grant your account access to system images containing Virtualmin Pro.

Creating an SSH Key

Before you can create any EC2 instances, you must create and register at least one SSH key with EC2. Fortunately, Cloudmin makes this easy - the steps to follow are :

  1. Open the Cloudmin Settings section on the left menu, and click on SSH Keys.
  2. Click on Add a new SSH key, which will open the key creation form.
  3. In the Key description field, enter something like Amazon EC2 key.
  4. Select the Generate new EC2 key option.
  5. Click Create.

Assuming that Cloudmin is able to contact the EC2 servers successfully, a new key will be created and registered. When an EC2 instance is created you must select an SSH key that will be used to initially login to it, and this key must be one generated using this process. Existing keys imported from some other source cannot be used.

Comments

Hi,

I have been using Virtualmin on EC2 for over a year using the Schedule/Backup console to backup my servers to S3 buckets. I am fortunate to have never needed to recover from my backups, but have encountered one mishap that required an unscheduled reboot.

While the virtual server backups are great,what would be the handiest way to persist the entire server state to S3? In the event of a serious failure I imagine it'd be faster/easier to boot a saved image instead of launching a clean instance and restoring each virtual server.

Thanks,

--(ti)--

Create a new volume that is as at least as big as the volume used by your EC2 instance and attach it to the instance, use dd to write out a copy of the AMI to the newly attached volume and then take a snapshot of the volume. Once that is done, you can use the EC2 tools to bundle the snapshot into an AMI that you can launch whenever it is needed!