Home » Getting Started with Amazon AWS

Getting Started with Amazon AWS

Signing up for AWS

  • Go to http://aws.amazon.com/, and click on “Get started for free”.
  • Register. Fill out all information fields. You must provide your credit card. We don’t expect you to spend any money on AWS for this course—thanks to Amazon’s generous support, you each have $100 of AWS credit, which should be plenty for coursework. However, if you overspend this limit you will be responsible for the charges incurred.
  • Verify your registration by phone. AWS will call you. When they do, enter the pin shown on the screen.
  • Once you’ve registered an account, go to https://aws.amazon.com/awscredits/, and enter your credit code you received via email. You should have $100 on your balance.

Creating an “Instance” (Virtual Machine)

  • Go to the AWS Management Console: https://console.aws.amazon.com/. Click on EC2. Then, click “Instances” menu item on the left and then click the “Launch Instance” button on the right.
  • You are now looking at the interface for creating a virtual machine from an image. For Step 1, select Ubuntu Server 13.10 – ami-ad184ac4 (64-bit). Make sure you get the correct one by verifying that it has the exact same image id (which starts with “ami-“) as the one we specify here.
  • For Step 2: Select General purpose, m1.small, which should be sufficient. Remember: better configurations will cost more! Don’t click on the default “Review and Launch”! Click on “Next: Configure Instance Details” (lower-right) instead.
  • For Step 3: Verify that the number of instances is 1, and that shutdown behavior is “Stop” (these should be defaults). Then click on “Next: Add Storage” (lower-right).
  • For Step 4: For the second row (“Root”) : increase its size (in GB) to 30. Now, click on the blue “Review and Launch” button (lower-right).
  • This will fast-forward you to Step 7. Go over the details listed and then click “Launch” at the bottom. If you need to change anything, you can navigate with the top menu, or with the previous/next buttons at the bottom.
  • You will be prompted to select an existing key pair or create a new key pair. Unless you are already experienced AWS user, select create new key pair, call your key pair datacourse. IMPORTANT: click on “Download Key”, save the file datacourse.pem in a safe and convenient location on your computer. This is the only way that you can access your virtual machine. Finally, click on “Launch Instance”.
  • Your virtual machine is now being created. It may take a few minutes before it is completely running.

Managing and Using an Instance

  • Go to the AWS Management Console: https://console.aws.amazon.com/. Click on EC2. Then, click “Instances” menu item to see what instances you have. If you click on a row, the bottom half of the page will show a detailed description of this instance. If the instance is currently running, you will see its “Public DNS” and “Public IP” addresses listed here, and you can connect to it using user name ubuntu. You will need your downloaded key to connect; there is no password.
  • Connecting to your virtual machine will vary depending on whether you have a Mac, Windows, or Linux computer. For a complete guide, refer to the following page: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html
    • For Mac and Linux, you can simply open up a Terminal, and issue the following command to connect (assuming you are in the same directory that contains your downloaded key):
      ssh -i datacourse.pem ubuntu@your_instance_public_dns_addr

      (If ssh complains about file permission, try:

      chmod 400 datacourse.pem

      You will only need to do this once.)

  • The only reliable access to your instance is through terminal-based ssh, so there will be no GUI programs. For example, you won’t be able to run Firefox or window-based editors on your remote instance (and browsers and editors on your own computer don’t have direct access to the instance’s files). Thus, you will need to learn to do things through the command line. On your computer, you can open multiple Terminals running ssh sessions, which still allows to multitask on your instance. For example, you can have one Terminal where you run an editor like nano, and another Terminal to run shell, python, or psql commands.
  • Another issue you will run into is working with remote files from your computer. You can use FileZilla (free from Duke OIT) to transfer files between your instance and your local computer. For example, to submit remote files for grading, you can first use FileZilla to download them to your local computer, and then use a browser on your local computer to submit them via the course website.
    • If you hate using Terminal-based editors inside ssh, then with FileZilla (or other similar programs), an alternative workflow is to create/edit code or input files on your local computer (using whatever your favorite editor is), use FileZilla to upload them to your instance, work with these files on your instance inside ssh, and then use FileZilla to download any output files to your local computer. You will need to remember to synchronize the files constantly and appropriately, however.
    • Yet another possibility with FileZilla is to use its built-in file editing future. You will need to enable it explicitly under settings; make sure you choose to “watch locally edited files and prompt to upload modification.” Once enabled, this feature allows you to select a remote file in the FileZilla interface and view/edit it in-place on your computer.
  • When you are done using your instance, go to the AWS Management Console, select the instance, and click on “Actions” then “Stop”. This is so you don’t accrue unnecessary hourly charges. The next time you want to access your instance, you need to “Start” it from the AWS Management Console. One minor annoyance is that your instance’s public DNS name and IP address will change—you have to look them up again in order to reconnect.
  • DO NOT “Terminate” your instance—this will completely wipe out all trances of your instance including all the data it stores.

Setting up GIT and Getting Course Tools and Data

  • To turn your Amazon instance into one customized for this course, you will need to perform some additional steps, just like those you took to set up VMware virtual machine. (Yes, you must do this for every virtual machine that you are going to use, be it a VMware one or an Amazon one.)  You will follow the same directions here, but with the following difference:
    • Since the only access you have to your Amazon instance is through terminal-based ssh, you can’t run a browser on your instance or have access to the Lubuntu desktop. So, instead of running a browser inside the virtual machine as instructed, just run a browser on your computer. Instead of opening up a LXTerminal as instructed, just log into your instance via ssh.
    • Before you proceed with the instructions, you must run following commands on your instance to install necessary programs and set correct time zone:
      sudo apt-get --yes install build-essential git elinks qt4-dev-tools libqt4-dev libqt4-core
      echo "US/Eastern" | sudo tee /etc/timezone 
      sudo dpkg-reconfigure --frontend noninteractive tzdata
      sudo service cron stop
      sudo service cron start

      Then you need to download Enthought Canopy using a terminal-based browser called elinks on your instance:

      elinks https://www.enthought.com/downloads/

      Use UP, DOWN to select links and RETURN to following the selected link. Choose 64-bit for Linux. This will download a file named canopy-1.3.0-rh5-64.sh in your home directory. Type ESC to access elinks menu and quit from it. Then, install and set up Canopy:

      bash canopy-1.3.0-rh5-64.sh
      ~/Canopy/canopy_cli --no-gui-setup
      ~/Canopy/canopy_cli setup ~/canopy
      sudo ln -s /home/ubuntu/Enthought/Canopy_64bit/System/lib/libpython2.7.so /usr/lib/libpython2.7.so

      When prompted for installation locations, press ENTER to accept the default ones. Important: when prompted to make this installation the default python, press y. Finally, reboot your instance:

      sudo shutdown -r now

      Log back in again after several minutes. (There is no need to stop the instance via the AWS Management Console.) You can now proceed with the instructions here.