Amazon EC2 + Windows 2008 + SQL Express – Getting your .Net 4.0 Apps online with SMTP

## Cloud computing with EC2

I decided to give [Amazon Web Services’ Elastic Computing][2] a go this week, and I must say I was pleasantly surprised.

At first, however, it seemed a daunting task to figure out how I will be billed, since Amazon introduces a host of TLA’s (three letter acronymns) that takes a little reading to understand what exactly you should subscribe to (even for someone coming from the Microsoft stall). Luckily, they provide a [simple monthly calculator][1] and after playing with the variables a bit, it was clear that Amazon’s solution is very competitively priced.

### South African credit cards work

For South Africans its not always easy to utilize all the wonderful web based offerings out there. We’ve learned to come up with creative ways to sign up and pay for a lot of online services, such as prepaid vouchers, creating overseas companies etc. It was not necessary to pull any tricks to sign up for Amazon Web Services and I could use my mobile number and South African VISA card to get going.


### Setting up

Setting up my new virtual server was truly a breeze, I think it took 15 minutes to get my ASP.Net app running on Sql Express, IIS and Windows 2008, even including updating the DNS entries and getting them to point to my new elastic IP address.

I chose the [Microsoft Windows Server 2008 R2 with IIS and SQL Server Express 2008 R2][3] AMI (Amazon Machine Image) and after getting my Administrator password from my generated key and logging in the first time I got that warm feeling seeing that

* .Net 4.0 was already installed
* Windows updates were already applied
* Sql allowed mixed mode authentication

Well done Amazon!


### SMTP email sending issue

So far, the only issue I had was with sending SMTP email. Understandibly, Amazon cannot allow any Tom, Dick and Harry to fire off a new virtual server and then spam the whole world. They do provide SNS and SES, (Simple Notification Service and Simple Email Service) as options to send emails from your EC2 server, but I decided on [][4]. The guys at provide a SMTP relay server for authenticated accounts at $0.001 per email, provided you don’t abuse it.


### Dropbox for publishing

To get your application’s files on the server, you can share your local drive while in a remote desktop session, or setup FTP services on your virtual machine, but I opted to use [DropBox][5].


I created a shared dropbox folder so the server account can link to it and set up IIS to point to this shared folder. Whenever I want to take new code live, I can simply publish from Visual Studio into my local dropbox folder and let dropbox do the rest. For this to work, you’ll need

* to ensure your config files that differ on local and live are not included in the publish
* the user with dropbox installed remains logged in on the virtual machine

*I’ll read up a bit to see if the second requirement can be dropped by running dropbox as a service and update this post if its possible.*

Posted in Blog, Develop