Amazon EC2 + EBS , is it financially smart for smaller startups? [closed]

I am trying to consider where to host my website and I am really sold on Amazon web services but I can't really decide if this is the course I want to take because of pricing. For one thing, I am not sure what setting to place into the cost calculator to get a good estimate.

I will be needing an EC2 instance since I will be running Apache server and as well I will be running a Java application which will be hosting a web-service which will interact with the MySQL database. (Which I am not sure if I should use Amazon RDS for)

If I had to make a very rough estimate (an optimistic absolute upper bound), I would say that I need to support 5 web requests per sec and around the same amount of requests on the MySQL. Maybe, 50gb of bandwidth out to users.

A small EC2 instance is : 'Small Instance (Default) 1.7 GB of memory, 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit), 160 GB of local instance storage, 32-bit platform'

A large EC2 instance is: 'Large Instance 7.5 GB of memory, 4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each), 850 GB of local instance storage, 64-bit platform'

So, If I pick the small I suppose I can expect a bill around 200 dollars and the large around 350 dollars. Do I just stay away from Amazon EC2 and look at smaller hosting companies?

Thanks a lot


Solution 1:

As you note, there are a number of costs associated with EC2, beyond the cost of running the instance, however, the 'instance-storage' mentioned in your question is not one of these.

Each EC2 instance (except the t1.micros) comes with ephemeral storage, that is included at no extra cost (neither for I/O nor storage). However, this storage does not persist - as soon as the instance is stopped or terminated, the contents of the ephemeral storage is erased. It is only useful for transient purposes (e.g. temporary files, some types of caches, intermediate files in build processes, etc)

You will, therefore, require an EBS volume to store your files - both for core software and your web application. I usually favour using at least 2 EBS volumes - one for the root volume, which I expect minimal changes to, and one for everything else (databases, logs, mail, application + user data, etc).

EBS Storage

I can't judge your storage needs, but software (operating system + LAMP stack + mail, etc) will likely be under 2GB. I presume your application is fairly small - which means that the unknown is user data (databases, files, etc) - I'd say 10GB is likely enough to start with in most cases.

  • EBS volume #1 - root volume - 4GB (allows for growth, some extra space on the drive)
  • EBS volume #2: 10GB
  • If you use a t1.micro, add EBS volume #3 - swap space - 1GB

Total: 15GB = $1.50/mo ($0.10/GB/mo)

EBS Estimated IOPS:

  • Root EBS - 2-5 IOPS
  • Data EBS - 10-30 IOPS
  • Swap EBS - < 1 IOPS

Total: 13 - 36 IOPS - cost: $3.42 - $9.46/mo (~$0.2628/mo/IOPS)

Bandwidth out

50GB/mo (your estimate) = $0.120*49 = $5.88/mo (1st GB is free)

Elastic IP

An elastic IP is free as long as it is attached to a running instance

Backups - EBS snapshots

I'd estimate around the same used space as your total data stored (the data is compressed and each snapshot is differential, but they do add up over time), so presuming you start with only 8GB of data + 2 GB on your root drive = 10GB (obviously, swap wouldn't be snapshotted);

10GB = $1.25/mo ($0.125/GB/mo)

Total, excluding EC2 instance costs:

Elastic IP - $0.00 EBS storage - $1.50 EBS I/O - $5.00 (a number in the middle of the range) EBS snapshots - $1.25 Bandwidth-Out - $5.88 Total: $13.63/mo

Instance Costs

Now, you need the actual instance costs. If you will be running the machine continually (required for a web server) - I'd suggest a reserved instance. (730 hrs/mo, on average)

t1.micro:

  • On demand = $0.02/hr = $14.6/mo
  • 1 year term (heavy utilization): $62 + 0.005/hr = $8.82/mo ((0.005*24*365+62)/12)
  • 3 year term (heavy utilization): $100 + 0.005/hr = $6.43/mo

m1.small:

  • On demand: 0.085/hr = $62.05/mo
  • 1 year term (heavy utilization): $276.25 + 0.02/hr = $37.62/mo
  • 3 year term (heavy utilization): $425 + 0.02/hr = $26.41/mo

Depending on the choices you make, your costs come out to somewhere between $20/mo (3 year reserved t1.micro) and $80/mo (on-demand m1.small).

Notes:

5 requests per second is a fairly small amount - even a t1.micro should be able to handle that. I would suggest trying your application on that instance type first (AWS does offer new customers one year of free t1.micro usage) - if you need a larger instance type, it is a simple matter of stopping (not terminating) your instance, and modifying the instance attributes, you can be back online in under 5 minutes running your new instance.

I am not a Java person - but if you can use a lightweight web server (nginx, lighttpd) instead of Apache you will get much better performance out of an EC2 instance (the primary problem with Apache is its memory usage, especially on a t1.micro).

If you use the t1.micro, I would advise against using a 64-bit operating system, it has a limited amount of memory, and the 64 bit registers considerably increase the needed memory with no tangible gain.

Also, I if you do not have a particular preference for an operating system, I'd suggest Amazon's Linux AMI - it is based on RHEL/CentOS with all the unnecessary parts removed, and is officially supported (and they keep their repositories up to date!).

Don't bother with Amazon RDS - most people find its performance to not be that great, and it doesn't offer much by way of 'automatic' functionality (e.g. you still have to manually setup replication, etc, and the normal limitations apply).

A word of caution regarding the t1.micros - their performance is highly variable - if you can keep your CPU usage low, you will be fine, but if you find it spiking, the performance will be awful. The other instances have much more stable performance.

Finally, while you want a good idea of how much it will cost, don't over-estimate. It is easy to speculate that you will need a mammoth of a server to run your application, but if you find it coming to that, you can always find a different provider later on, or shift to a different instance type. With the cloud model, you don't need to factor in future scale as much, because it is fairly easy to scale.

You can try the AWS Cost Calculator to play with the numbers (although, personally, I prefer doing it by hand).

Solution 2:

You should be able to easily support 5 Apache requests/second off the $15/month micro instances. A small instance will run you $60/month or so, and as with the micro instance should run MySQL + Apache just fine, so I'm not sure where the $200 comes from.

Things also become drastically cheaper - as much as half off - if you can commit to a one or three year period for that instance type.