Old Old EC2 instructions

(Thanks to Yarko Tymciurak for getting us started on this!)

There are two options for setting up a saas-book instance on EC2- via CloudFormation (you will need a key pair but not an AMI ID) and the traditional way (key pair created through a wizard).
The details for each of these approaches are located here.
(Thanks to Shakil Langha and Jinesh Varia of Amazon for setting this up!)

These quick-start instructions are designed specifically for the SaaS course and book, and reflect the traditional means of launching an instance. Complete documentation on EC2 is available at Amazon.
  1. Sign up for the AWS free usage tier if you don't already have an AWS account. This requires a valid credit card, but you will not be charged if you stay within the Free usage limits, which should be sufficient to do the work in the book. Please read the AWS Free Usage Tier payment terms carefully; we are not responsible for charges you incur.
  2. Once you register, Amazon will send you an email with a link to complete the registration process by creating "access credentials". However, you can skip this step, as the type of credential you will need is a keypair for EC2, which must be created from the AWS Management Console.
  3. Log in to the AWS Management Console, click the EC2 tab, and click the Launch Instance button. (An "instance" is Amazon's term for a VM running on EC2.) Note that your region (AWS datacenter location) may not match the one in the example image.

  4. On the Launch Instance popup window, choose a meaningful name for your instance. The first time you launch any instance, you'll need to create a new keypair, which is the credential that lets you login to the instance once it's running. Enter a meaningful name for your keypair and click Download to create the new keypair. Your browser will download a file whose name ends in .pem (originally from Privacy Enhanced Mail, part of the X.509 security standard). Keep this file in a safe place and don't reveal its contents: it is your private key, which allows its possessor to login to your EC2 instance. On future occasions, you'll be able to choose "Select an existing key pair" to use this key, so you don't need to create a new one each time. For "Choose a launch configuration", scroll all the way to the bottom and select "More Amazon Machine Images", and click Continue. Mac and Linux users: You should also do chmod 0600 filename.pem to set restrictive permissions on the private key file, otherwise ssh might complain.
  5. In the Search box for the Create New Instance popup, type the name of the correct AMI as it appears in the table at the top of this page. When you get a match, also verify that the AMI ID matches what appears in the table, so you know you are using the correct AMI. Click on this AMI, then click Continue. This image is only an example; use the table at top of this page to get the correct AMI name and ID!

  6. Review the settings and click the Launch button. It will take a few minutes to launch your instance. Click the Refresh button on the AWS Management Console until it shows your instance as "running".
  7. Click on "1 Running Instance", and when the My Instances panel appears, check the box next to your instance name. This will cause details about your instance to appear in the lower part of the screen, including your instance's publicly routable DNS name, which will end in something like .compute-1.amazonaws.com.
  8. Open a Terminal window on your Mac or Linux computer or a Console window on your PC, and login to your instance with the following command line. Replace yourkey with the filename of the private key you downloaded in step 4 and yourinstance with the DNS name reported in step 7.
    • If you have an X server installed on your computer (such as XMing for Windows or XQuartz for Mac OS X; Linux distributions generally include X) and want to run X11 apps on the instance (see Appendix A of book), use this command line, which enables X tunneling over ssh and uses a more compact encryption scheme that should speed things up:
      ssh -X -C -c blowfish -i yourkey ubuntu@yourinstance
    • Otherwise, for terminal access only:
      ssh -i yourkey ubuntu@yourinstance
    • If you're prompted that the authenticity of the remote host can't be established, it's OK to continue.
    • If the command fails with "Permission denied (publickey)", make sure you included ubuntu@ in the command line.
    • If the command fails because the permissions on the private key file are too open, make sure you followed the "Mac and Linux users:" note in step 4.
    • If the command fails with "command not found", you may need to install Secure Shell (ssh) on your system. Putty is the recommended Windows ssh program, but you must convert your key pair to a type which Putty supports (instructions for this can be found here). Mac OS X and Linux come with ssh.
  9. Note that a SaaS app running on your instance is publicly accessible
  10. When you are finished using your instance, you should use the Instance Actions menu on the AWS Management Console to stop it, so you don't continue to accumulate usage charges. If you STOP an instance, the instance goes away and you are no longer being charged for it, but the virtual disk connected to it persists, so you usually want this option. However, usage charges for persisting the disk will apply once you have exhausted the limits of the Free tier. If you TERMINATE an instance, the virtual disk connected to it is destroyed, and everything on it (including your work) is lost. Since the Free tier includes 750 compute-hours per month for a full year, you should probably not terminate the instance while taking this course. (Even if you do, though, you should be using Git and either GitHub or ProjectLocker to back up your important work to the cloud, as described in Appendix A of the book.)
  11. Turn off your instance when you are done!