====== Adding an EC2 Account ====== EC2 is different from other virtualization systems supported by VM2, 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. VM2 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 : - 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**. - 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. - Mouse over **Your Web Services Account** again, and click on **Account Activity**. - At the top of the page is your **Account Number** . ===== Adding Your Account to VM2 ===== Once you have found your EC2 account number, access key and secret key, the account can be registered with VM2. The steps to do this are : - On the left menu, open the **VM2 Settings** section and click on **EC2 Accounts**. - Click on the **Add an EC2 account** link. - On the page that appears, enter a short name for this account in the **Account description** field, such as //Bob's EC2 service//. - Fill in the **Account ID**, **Access key ID** and **Secret access key** fields with the account details retrieved from Amazon. - 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, VM2 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, VM2 makes this easy - the steps to follow are : - Open the **VM2 Settings** section on the left menu, and click on **SSH Keys**. - Click on **Add a new SSH key**, which will open the key creation form. - In the **Key description** field, enter something like //Amazon EC2 key//. - Select the **Generate new EC2 key** option. - Click **Create**. Assuming that VM2 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.