Friday, March 26, 2010

Tutorial on getting a LAMP stack EC2 instance up and running.

In this tutorial I'll walk you through getting a simple "site" up and running on EC2 using the default LAMP AMI.

NOTE: I'll assume you have a working site, see this post for the code I'll be uploading. So, let get started.

STEP 0:


Signup for an Amazon Web Services account. Setup your payment, yadda yadda.

STEP 1:


Click on "Sign into AWS Management Console"


This should take you to https://console.aws.amazon.com/ec2/home

STEP 2:


Click on the big "Launch Instance" button. And choose the LAMP Web Starter AMI.


STEP 3:


Choose 1 instance, no preference on availabiliy zone, and "Small" type.
Click "Continue"

On the "Advanced Instance Options" use the defaults and click "Continue"

STEP 4: Create your Key Pair


Choose the radio button to "create a new Key Pair"
Enter a name "EC2LampTurotial" or something that is usefull for you.

click "Create and Download" and save the .pem file somewhere you can find later.

STEP5: Create a Secutiry Group


Give it a name you can remember "LAMP Secure" or something like that. The default ports that are open should be all you need for accessing your LAMP server.


Click "Continue"

STEP6: Review settings and launch


If everything looks OK, then launch.


Close the Wizard window, and while it's launching let's get ready to connect

STEP7: Gennerate Public Key


On windows, I use Putty. From that link, you will need "PuTTYgen" and "PuTTY".

Launch PuTTYgen. Load Private Key File (change file filter to "all Files") locate the .pem file you downloaded previously and open it.


Now save your private key somewhere you can find it.

Close PuttyGen

STEP8: Putty


Launch Putty
In the Category section, under Connection, under SSH select Auth. Load you ppk file you just saved. DON'T LAUNCH JUST YET.

Go back to you AWS management console. Select the instance you just launched from the instances section. In the details, copy the full name of the Public DNS Name. It should look something like ec2-174-129-141-110.compute-1.amazonaws.com.

Go back to putty, and at the top of Category, select Session. Paste that host name into the Host Name box.
[port = 22, type = ssh]
Click Open.

Accept the PuTTY Security Alert.

login as: root
hit return. And you should be in.


So. Now you are logged in. Yay!

Step 9


Make a site. (See above)

NOTE: all site files are by default in
/home/webuser/helloworld/htdocs/

If you are knowledgeable in apache and linux, go ahead and customize that. But there is not pressing need to change it.

Step 9b


Make a db

Remember, this is LAMP-land. And you are root. So go ahead and from your SSH window

# mysql -u root -p

when prompted for a password just hit return. Good to go

mysql> create database friendface;
Query OK, 1 row affected (0.00 sec)

mysql> connect friendface;
Connection id: 3
Current database: friendface

Now, let's load some data. Hop of mysql

mysql> exit;

grab a database definiton. You are free to use mine:

# wget http://seis752.s3.amazonaws.com/mysql.txt

once that finishes

# mysql friendface -u root -p <mysql.txt

now hop back into mysql and check it out.


mysql> connect friendface;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Connection id: 8
Current database: friendface

mysql> show tables;
+----------------------+
| Tables_in_friendface |
+----------------------+
| something |
| users |
| zipcodes |
+----------------------+
3 rows in set (0.00 sec)

mysql> select count(*) from users;
+----------+
| count(*) |
+----------+
| 1000 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from zipcodes;
+----------+
| count(*) |
+----------+
| 3790 |
+----------+
1 row in set (0.00 sec)

mysql>



And, viola! Now, open a browser, punch your DNS name into the address bar. And you should be good to go!

Lloyd

Video of me doing above things (in two parts):
Part 1:


Part 2:

Wednesday, March 24, 2010

HW6 - EC2 - SEIS752Spring 2010

SEIS752 – Advanced Web Application Development   [Spring 2010]
Professor Lloyd Cledwyn
HW #6:   Cloud Computing
Due:        April 7th, midnight.

Summary

Lauch your very own server in the cloud.

Purpose:

Introduce yourself to the options withing Amazon Web Services.

Assignment:

  1. Launch your own EC2 instance.
  2. Upload one of the homeworks you have worked on.  (Modify the main page with your name in <h1> tags.
  3. Email me the URI of the working site.
  4. Once I confirm it's working you can terminate your instance.

Resources:

  1. Tutorial pending.  Feel free to poke around and get started.

Deliverables

  1. Email proof and confirmation from me of a working EC2 instance running your application.