Difference between revisions of "Amazon Web Services"

From CSE330 Wiki
Jump to: navigation, search
(Created page with 'Amazon Web Services provides a method to publish web sites on virtual machines in the "cloud." In CSE330, you will be using an EC2 instance to host your web site. Before readin…')
 
(Accessing your EC2 Instance)
Line 44: Line 44:
  
 
It will probably be more convenient for you to use an SSH client on your machine so that you do not have to log into AWS every time you want to access your server.  However, which option to use is up to you.
 
It will probably be more convenient for you to use an SSH client on your machine so that you do not have to log into AWS every time you want to access your server.  However, which option to use is up to you.
 +
 +
At first, you will need to SSH into your server using Amazon's default user.
 +
 +
* In the Amazon AMI, the default user is '''ec2'''
 +
* In Ubuntu 12.04 LTS, the default user is '''ubuntu'''
 +
 +
If you want to log into your server using your own username, refer to [[Web Server Configuration#Adding SSH Users|the Web Server Configuration guide]].

Revision as of 18:02, 23 August 2012

Amazon Web Services provides a method to publish web sites on virtual machines in the "cloud." In CSE330, you will be using an EC2 instance to host your web site.

Before reading this guide, you should be familiar with Linux and the various distributions of Linux. Fore more information, refer to the Linux guide.


Creating and Configuring your EC2 Instance

Follow these steps to get to the AWS Management Console:

  1. Create an AWS account: http://aws.amazon.com/
  2. Sign up for the EC2 Web Service: http://aws.amazon.com/ec2/
  3. Log in to the AWS Management Console

To create your new virtual machine, click Launch Instance. Do the following to configure your instance:

  1. Use the Classic Wizard.
  2. Now choose what distribution of Linux you would like to use. For more information on distributions, refer to the Linux guide. The following are both good choices that the TAs know how to use:
    • Ubuntu Server 12.04 LTS (based on Debian)
    • Amazon Linux AMI (based on RHEL)
  3. The default instance variables are all fine. Click Continue until you get to the "Create Key Pair" screen.
  4. Create a new Key Pair. Enter some name for it, and then click "Create & Download your Key Pair". Save your key pair somewhere secure that you will be able to access whenever you want to SSH into your server.
  5. Once you have downloaded your key, set the permissions on it such that only you can read it; that is, the *.pem file you downloaded should have permissions -r--------. For more information on setting file permissions, refer to the Linux guide. (Can you think of any reason why you wouldn't want other people viewing your private key file?)
  6. Create a new Security Group. The security groups you create determine whether a port is open or blocked for your server.
    • You need to open the SSH port on your server. To do this, select "SSH" from the drop-down box, and then click "Add Rule."
    We will be opening more ports by modifying the security group at a later time. Click Continue.
  7. You are now ready to launch your virtual server! Click Launch.

Starting and Stopping your EC2 Instance

You can start and stop your instance by right-clicking on the instance. The options are down in the "Instance Lifecycle" section.

Note: Remember to stop your server instance when you are done using it, for otherwise your account will be charged hourly.

VERY IMPORTANT: Never "terminate" your instance, as this PERMANENTLY DELETES the instance- you will lose all your work! Any time you are done using the instance you should instead "stop" the instance and then when you are ready to resume work you should "start" the instance.

Note: This is one reason why it is a good idea to commit all your code for various projects to your SVN repository just in case you accidentally terminate your instance.

Accessing your EC2 Instance

To access your instance via SSH, right click on the icon for the instance and click Connect. You have two options:

  1. You can use an SSH client on your computer. Amazon gives you instructions, and even gives you the command you need. For more information, including how to use SSH on Windows, refer to the Web Server Configuration guide.
  2. You can use an SSH client that Amazon provides that runs in your browser.

It will probably be more convenient for you to use an SSH client on your machine so that you do not have to log into AWS every time you want to access your server. However, which option to use is up to you.

At first, you will need to SSH into your server using Amazon's default user.

  • In the Amazon AMI, the default user is ec2
  • In Ubuntu 12.04 LTS, the default user is ubuntu

If you want to log into your server using your own username, refer to the Web Server Configuration guide.