This is super fast and easy. Here we go:

Step 1: Literally the first step

Create and log into your http://aws.amazon.com account. Yadda yadda yadda.

Step 2: Pick your AMI

Click the giant Launch Instance button under the EC2 tab. I personally like to use Ubuntu (because its the best), so I chose Mr. 12.10 there in the middle, but you should choose whichever version of Ubuntu is highest by the time you stumble on this post.

step1

Continue down this path of glory, choosing mostly defaults. There are, however, a few notable exceptions that can prevent you from driving 3 states in the wrong direction.

  • Definitely make a KeyPair. This allows you some nice login security that no one outside of MIT understands.

  • The standard ports security group will be good unless you need to open up a database to the outside world. If so, and if said database is MySQL, add port 3306.

step1

PRO TIP: You cannot change your port security group once you set it. If you forget a port, you will have to relaunch a new EC2 instance. Luckily this is easy.

Step 3: Reserve your Elastic Intellectual Property:

I mean... Elastic Internet Protocol address. Wrong IP. At any rate, under Network & Security on the left, select Elastic IPs. You want to allocate a new address (at the top), then associate it with your brand spanking new EC2 instance that is currently spinning up.

Step 4: Logging In

You downloaded a copy of your key, so now you're ready to do something like this:

ssh -i /path/to/key-pair/file/you/just/downloaded/MyKey.pem ubuntu@MY-SHINY-NEW-IP

You should expect to see some jargon like this:

step1

Type yes or go home.

If we're on the same page, you should be rocking and rolling inside your VM! That's pretty exciting because you're currently inside a real, live webserver. [oohs] [aahs]

Step 5: Get your instance up to speed!

Because the Ubuntu, and Linux as a whole, community is huge, things are moving fast. Even though you picked the most updated version of Ubuntu because you're a huge pro, it's likely already behind the times. You'll know by this prompt at your login:

0 packages can be updated
0 updates are security updates

If you see that, you're good. If you see numbers other than zero, fix it with these simple commands:

sudo apt-get update
sudo apt-get upgrade

NOTE: I just ran those commands for S's and G's anyway, despite seeing zeros, and plenty of stuff upgraded and updated, so who knows. Maybe just run them anyway.

Step 6: Start installing stuff today!

We're so close to having our instance ready! Run this epic command:

sudo apt-get install apache2 mysql-server libapache2-mod-wsgi python-dev libmysqlclient-dev python-setuptools

  • It will prompt you for root user password when it gets to MySQL. Don't forget what you enter, lest you be totally screwed. Well not really, but it would definitely be a minor inconvenience!
  • While you're at it, don't have the root's password be root. Have it be something crazy like ihatepizzawithoutenoughsaucebecausewtf

mod-wsgi Is what will let Apache talk to Python. (Pro Tip: This is important) However, it's not actually activated yet, so run this command to fix that:

sudo a2enmod mod-wsgi

If that didn't work, run sudo a2enmod wsgi. Thanks to @jack_slingerland for the pro tip.

If you see Module wsgi already enabled then... great.

Step 7: Install final Python tools

Run:

sudo easy_install virtualenv
sudo easy_install pip

Step 8: Continue with the code-specific part of the tutorial here

http://craiglabenz.me/2013/03/23/deploying-this-blog-part-2/


comments powered by Disqus