Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Amazon EC2 to host Asp.net application

Tags:

I’m currently developing an application that will be heavy on images, that I hope to host “in the cloud”

It’s a c# / asp.net application.

So i'm considering using Amazon S3 for storing the images. That bit’s fine.

However, i'm considering using EC2 to host the application on.

The application uses SQL server (only on a fairly basic level) Im wondering how to set up my hosting solution. Would it be advisable to:

  • Have 1 small instance dedicated for SQL server (would use the express edition to start with)

  • Have 1 small instance dedicated to
    running IIS (and hosting the
    application) point the sql conn
    string to above mentioned sql
    instance

  • Use elastic block store to store the SQL data & aspx pages, compiled
    assemblies etc…

Any other ideas??

like image 414
Alex Avatar asked Jul 08 '09 14:07

Alex


1 Answers

Keep them all on the same instance for now, don't prematurely optimise/scale. You might find simply upgrading to a medium-cpu instance (36c/hr instead of 12c/hr) will be enough to keep you running for months without any kind of scaling headaches.

In the future, if you outgrow your single-server setup, then you can move your DB onto a separate instance, initially a small-cpu, upgrading to a medium later.

One thing that's worth noting is that if you can't upgrade from a medium-cpu to high-cpu instances because the 32-bit OS images won't run on larger instances, and 64-bit won't run on smaller instances.

Pick 32-bit Windows (because EC2 uses this for smaller and medium instances), run on a smaller, single instance and then scale up when you need to.

Regarding EBS - I'd recommend creating a healthy sized volume that'll keep you going for a while and configure SQLServer to store its data there.

You could store your ASP.NET app on an EBS volume as well, but the instance's 10GB OS drive might be fine, I don't think there's much difference here.

I'd strongly recommend using an Elastic IP rather than the temporary IP EC2 assign you on launching an instance. Create an Elastic IP, update your DNS to point to it and associate it with your instance.

After getting your image configured how you want it, shut it down, bundle the instance and then register a new AMI for it (privately). It'll take about 40 minutes. This means if something horrible happens to your instance, you can recover within 15 minutes by following these steps:

  1. Detach your EBS volume
  2. Disassociate your Elastic IP
  3. Terminate your faulty instance
  4. Launch an instance of your AMI
  5. Attach your EBS volume to the new instance
  6. Associate your Elastic IP with the new instance
like image 156
Matt Brindley Avatar answered Oct 16 '22 00:10

Matt Brindley