Moving a IIS WordPress Site to Amazon EC2 (New Prices!)

What is Wrong with Home Server?

After a RAID drive hiccup on my local Windows 2008 Server, I was more inclined to consider an external hosting options.  And one of my friends already uses Amazon hosting for at least 4 years now.  So I decided to invest some time to explore this option.

 

What is Covered Here?

– Terminology
– Pricing
– How to  extract your original ADMIN password
– How to open a Custom Port on My Amazon Server
– How to transfer files using RDP
– How to launch an instance with Instance Store
– What if I am Using SQL Express and need a regular D/B Backup

 

Terminology

Fist of all , here are some useful abbreviation and terminology:

Code Description
AWS Amazon Web Services – As appears on your credit card bill
EC2 Elastic Compute Cloud – You will have your drop in that cloud.
Instance A virtual machine that you setup and run.  That is your web server.
EBC ELASTIC BLOCK STORE – A hard drive.  Volume for System drives and Snapshots for backups.  This volume is visible in your EBS list and it can be detached from one instance and attached to a different instance.  You always pay for this storage, even when instance is stopped  After initial year of free storage, you pay $1 per 10GB of storage.
Instance Store Small instance and up include “free” storage.  You get this free storage with Instance Store.  For example Small instance get a 160GB of instance store.   This storage is not visible in your volume list, can only be used with a given instance and will disappear with an instance.
Elastic IPs You grab a block of IP(s), but they are only to make your instance unique.  They are normal public IP addresses.   It appears that only one IP address can be attached to an instance.
Command Line Tools A lot of tasks can’t be performed using AWS Console.  You need a free JAVA-based commands that you need to configure once and use from your Commend Prompt
AMI Amazon Machine Image – Everything (on one Instance).  You pick your initial AMI to start with.  You save your AMI before moving or upgrading.  You create your own AMI(s) for future use.
RDP You use regular Remote Desktop Protocol to connect to your instance.  You also use RDP to share your local drives and transfer you site (Files and Database dumps) to Amazon instance.  For some reason it took almost 12 minutes of intense search to find out.
Reserved Instance You can buy an empty shell, a wrapper, a placeholder that will represent a lower billing over 1 year or 3 year period.  You have to pay a one-time fee to reserve a lover rate for 1 or 3 years.  We found that the most economic sense has Small Heavy utilization instance for 1 year ($195 and rate 0.036 per hour).

So, what can you do with all that wealth of information?  You login to your regular Amazon account, and now system knows your address, and your credit card, and your phone number. Robot calls you, and you punch in the code from the screen to verify that you are actually you.  Now you have to make a bunch of decisions.

 

Pricing for Windows Instances (as of 2012-03-16 FR)

Amazon prices are steadily falling.  Here are the pricing for Windows instances.    Comparison runs into 3 dimensions:

Instance type: On-demand, 1 year or 3 years;

Instance size: Micro or Small;

Instance utilization: Light Medium or Heavy.

 

Util Inst Mem GB Term Initial
Pay
Per
Hour
Per
Day
Net
Monthly
Bill
Total
over 3
years
True
Per
Month
Save
over 3
years
Light Small 1.7 160 none 0.110 2.640 80.30 2,890.80 80.30
Light Small 1.7 160 1 year 69.00 0.059 1.416 43.07 1,757.52 48.82 39%
Light Small 1.7 160 3 years 106.30 0.051 1.224 37.23 1,446.58 40.18 50%
Light Micro 0.6 EBS none 0.030 0.720 21.90 788.40 21.90
Light Micro 0.6 EBS 1 year 23.00 0.018 0.432 13.14 542.04 15.06 31%
Light Micro 0.6 EBS 3 years 35.00 0.018 0.432 13.14 508.04 14.11 36%
Med Small 1.7 160 none 0.110 2.640 80.30 2,890.80 80.30
Med Small 1.7 160 1 year 160.00 0.044 1.056 32.12 1,636.32 45.45 43%
Med Small 1.7 160 3 years 250.00 0.039 0.936 28.47 1,274.92 35.41 56%
Med Micro 0.6 EBS none 0.030 0.720 21.90 788.40 21.90
Med Micro 0.6 EBS 1 year 54.00 0.013 0.312 9.49 503.64 13.99 36%
Med Micro 0.6 EBS 3 years 82.00 0.013 0.312 9.49 423.64 11.77 46%
Heavy Small 1.7 160 none 0.110 2.640 80.30 2,890.80 80.30
Heavy Small 1.7 160 1 year 195.00 0.036 0.864 26.28 1,531.08 42.53 47%
Heavy Small 1.7 160 3 years 300.00 0.033 0.792 24.09 1,167.24 32.42 60%
Heavy Micro 0.6 EBS none 0.030 0.720 21.90 788.40 21.90
Heavy Micro 0.6 EBS 1 year 62.00 0.011 0.264 8.03 475.08 13.20 40%
Heavy Micro 0.6 EBS 3 years 100.00 0.011 0.264 8.03 389.08 10.81 51%

 

[From our Archives] Here is an old pricing (as of 2010-10-25):

Instance Type Instance Upfront Per Hour Per Month Over 1 year Over 3 Years
On-Demand Standard 0.120 86.40 1,051.20 3,153.60
On-Demand Micro 0.030 21.60 262.80 788.40
1 year Standard 227.50 0.050 36.00 665.50 1,996.50
1 year Micro 54.00 0.013 9.36 167.88 503.64
3 year Standard 350.00 0.050 36.00 N/A 1,664.00
3 year Micro 82.00 0.013 9.36 N/A 423.64

You need to pick you platform (32-bit or 64bit), and your image (pure W2K8 Server, or with SQL Express, or some other variations that people created and saved).  Take your time to browse through some of the possible initial images.

Launch your image, and now you are ready to receive your Administrator’s password.  Create a Key Pair.  It means you will receive a file containing a private key.  Amazon will hold a public key.  You will use these, when extracting your Administrator’s password.  You will receive your password over email.

Get Your Admin Password

Say, you already have a key pair.  But how to extract your admin password?  Right click on your instance in console and select Get Windows Password.  Paste your Private Key from PEM file that you received, when you originally generated a Key Pair.

Allocate new random Elastic IP address and assign it to your instance.

How to Connect to My Amazon Server

You can access your Amazon instance with RDP (port 3389) or with Internet browser (port 80).   You can type the address in several formats:

You can type-in your reserved  IP address  http://NN.NN.NN.NN/ or
use a long name that mapped to the same instance: http://ec2-NN-NN-NN-NN.compute-1.amazonaws.com/

`

How to upload your site to Amazon Instance?

It took me some time to find the answer on Google.  It is a little-known feature of RDP.  Configure your RDP link before connecting to Amazon server. In  Remote Desktop Connection dialog go to  Options – Local Resources – Local devices and resources section – More… button.  Here you can pick any local drive that will be available to you upon connecting to a remote server.

When you connect to Amazon server, your local drive will show up in Windows Explorer.   If you shared your local drive D:, you would be able to access it from Amazon server as \\tsclient\D.   Now you can copy and paste files and directories to your delight in both directions.

And yes! – You can change the default RDP port from 3389 to anything you want, but do it at the very early stages of Instance building – one wrong step and you can loose the entire instance by rendering it unreachable.  Open new port in Windows firewall, Open new port  on Amazon console, apply the registry fix to change the port.  Restart, and try to connect on a new port.

`

How to Open a Custom Port on My Amazon Server

You can open a custom port using Amazon EC2 Console at https://console.aws.amazon.com/ec2/home

If you open a custom port (say 8383 for testing) using Amazon EC2 Console Dashboard, you should be able to access your test sites using http://NN.NN.NN.NN:81/

You have to remember to open your port 8383 on Windows Firewall inside your instance.  So, you are opening it in two places:
in (1) Amazon EC2 Console Dashboard (new and unusual, but very simple) and
in (2) Windows Firewall (usual and simple).

`

Thing to Remember after Uploading your WordPress site to Amazon

You need to install and configure both PHP and MySql on your new remote server.

If you are getting “Internal Server Error 500” and a message about FastCGI – try deleting web.config from the root of your site.

If you are getting “Error Establishing Database Connection“, edit wp_config.php to correct Database name, user name or password.

Reconfigure SMTP settings to use different port and possibly SSL.  What worked from you internal network might not work from a remote location.   You Internet provider should have instructions for  a remote SMTP connection scenario. Test, if all your Send Messages features are still working.  Create a new user and make sure message with password is properly send and received.

`

How to launch an instance with an Instance Store Volume

[This material is unique to this site]

By default, when you launch a new instance from AWS Console, you get 30GB EBS volume regardless of the instance type.  But you want to get you mega-gigabytes that you are designated to.

There are plenty of words in documentation, but very little clear instructions. This section will help you to launch a small Instance with a 100GB root EBS volume and 160GB Instance Store volume.  I took me 7 hours of support call, reading documentation and actual testing (that cost money) to finally get a little understanding of how to get designated “free” 160GB of storage that come with a Small instance.

You need to use Command Line tool.   To do that you need to configure Command Line tool.  There is a perfect, detailed step-by-step documentation on how to configure this tool. And steps actually work.  That is easy part.

Now, to the tough part. Here is a list of things to remember:

(1) You can only get Instance store when you launch your instance.

(2) You can only get your Instance Store if you use Command Line Tool.

(3) If your image (AMI) is EBS-based, you can’t overwrite or re-map that.

(4) Number in Instance-based AMI is very limited and outdated

With all this in mind, here is command to launch a new small instance (into VPC) with 100GB EBS volume (/dev/sda1=:100:false)  and 160GB Instance store (/dev/sda2=ephemeral0):

ec2-run-instances ami-883de1e1 -g sg-ebb77777 -k “YOUR KEY PAIR” -t m1.small -b “/dev/sda1=:100:false” -b “/dev/sda2=ephemeral0” -s subnet-4da44444 –debug

This command is one long line. This command uses AMI ami-883de1e, security group ami-883de1e, Key pair YOUR KEY PAIR, and is launched into a VPC subnet “subnet-4da44444”.

When instance is launched, you see only EBS volume in AWS Console.  You need to actually RDP to the instance, login with admin password and extent the 30GB partition into entire available 100GB (using diskmgmt.msc).

 

`

What if I am Using SQL Express and need a regular D/B Backup

If you are hosting SQL Express /ASP.NET sites, you need to use a special script to scheduler a database backup.  See an article here to do that:

Automate Database Backup in SQL Express http://www.domainwebcenter.com/?p=594
(Visited 207 times, 1 visits today)

2 Trackbacks / Pingbacks

  1. Meetup Just-Dev-It-One WordPress @ TEQCorner | Jules Bartow
  2. Amazon Web Service, Bitnami, WordPress Meetup DC « Jules Bartow

Your question, correction or clarification Ваш вопрос, поправка или уточнение