Using R on Amazon EC2 under the Free Usage Tier
- Go to the homepage for Amazon Web Services, ‘aws.amazon.com’. Sign up by clicking the ‘Sign Up Now’ button on the right.
- Create a new Amazon account, or log in to an existing account.
- You will need to provide credit card information, even if you only plan on using the Free Usage Tier.
- Provide a telephone number. You will be called and given a PIN number which will be used to verify your identity. When this step is finished, you have an account. Click ‘Continue’ to go back to aws.amazon.com homepage. Log in to AWS by clicking the ‘Sign in to the AWS Management Console’ link on the aws.amazon.com homepage.
- You are now in the AWS Management Console. Under the ‘EC2’ (Electronic Cloud Computing) tab, click the ‘Launch Instance’ button.
- Choose an instance. Starred instances are free (part of the Free Usage Tier). Select the ‘Basic 64-bit Amazon Linux AMI 2011.02.1 Beta’.
- Next, specify ‘Instance Details’. Keep all defaults. (Note: the Free Usage Tier is for Micro Instances only.) Click ‘Continue’ at successive screens.
Provide a descriptive name for this Instance (here, ‘Micro Instance with R Self Build’). Click ‘Continue’.
- Create a new Key Pair. Provide a name for the new key pair (here, ‘newkey’). Click ‘Create & Download your Key Pair’.
- Create a new Security group. Port 22 should already be selected. Add a Group Name (here, ‘basic’) and Group Description (here, ‘22 open for SSH’). Click ‘Continue’.
- The Instance is now launching. Click ‘View your instances on the Instances page’.
- If using a Windows machine, you will need to SSH (secure shell) to your Amazon EC2 instance using a free tool called ‘PuTTY’. Go to the PuTTy homepage at www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Click ‘putty.exe’ and ‘puttygen.exe’ to download the necessary binaries.
- Open ‘puttygen.exe’. Go to the ‘Conversions’ tab and select ‘Import Key’. Search for and select the key pair created in step 9 (named ‘newkey.pem’). Click ‘Save private key’ (here, this is saved as ‘newkey.ppk’). You will be prompted to add a passphrase; it is not mandatory to add a passphrase.
- Open ‘putty.exe’. On the left, navigate to ‘Connections/SSH/Auth’. In the ‘Private key file for authentication’ field, browse to the location of the saved key (here, ‘newkey.ppk’) from the last step. Next, on the left, navigate to ‘Session’. In the ‘Host Name for IP address’ field, enter the Public DNS (Domain Name System) from your AWS management console (see detailed instructions below on how to find the Public DNS). Click ‘Open’.
To find the Public DNS, go to your AWS management console as shown below. Check the box to the left of the newly created instance (here, named ‘Micro Instance with R Self Build’ in Step 7). Details, including the Public DNS, will display. Copy this to the ‘Host Name for IP address’ field shown above, right.
- Click ‘Yes’ when the following box displays as this will be the first time logging into this server.
- Log in using the default user for the instance, ‘ec2-user’. You are now in the Cloud.
16. To install R inside the Cloud, type the following lines of code.
Whenever prompted with ‘Is this ok [y/N], enter ‘y’.
The line ‘sudo make’ will take about 30 minutes to run.
The next line let’s you see if everything worked correctly.
Open R by typing ‘R’, and you are ready to use R in the Cloud.