3

I want to develop a J2EE web application using Amazon AWS. Which components of AWS should I plan on utilizing and for what purpose?

Here are the general specifications of my application:

  • The MVC model with servlet, JSPs, JPA on a SQL Server database instance.
  • Database does not currently exist
  • The application will be used for running small-scale financial scenario models with assumption inputs from the user through HTML forms
  • Aurora is not planned for the application

Spec designs:

  • 10k I/Os
  • CPU: ~2 GHz
  • Memory: 2 GBs
  • Database size: 2 GBs

No assets are planned initially other than data on the database; plan is to render data into JSPs with minimal design components.

I want to be responsible for minimal server and database administration.

Target budget is $10-20 per month.

What can I use from AWS to meet this budget and these specifications?

George Stocker
  • 57,289
  • 29
  • 176
  • 237
Declan
  • 448
  • 10
  • 27

1 Answers1

5

Updated for 2018 pricing

Since you want to be responsible for the server administration, that puts you in EC2 territory (Virtual Machines on AWS's cloud infrastructure, essentially).

This is the cloud. You really don't want to know what it'd cost to keep to your specifications (it'd be more than you can afford). Due to the nature of the EC2 T2, you get CPU credits, so the longer you leave it running (and not using it), the more credits you do get for when you do use it. In this way, it'd meet your specifications, assuming diurnal usage.

Let's assume for an instant (to keep costs down), you want your SQL Server and your Web application on the same EC2 instance (you really shouldn't do this).

For EC2, given your requirements to run IIS and SQL Server on the same host (to save money), the lowest host you'd be able to use is a SQL Server Web Edition 2014 / Windows 2012 R2 T2.Medium currently at $0.272/hour.

SQL Server Web 2014 / Windows 2012 R2 (T2.Medium)

   2015         2018    

   .272        .1358
x   750     x    750
-------     --------
 198.83       101.85

Since it has no Instance Store, you'll pay for the root EBS volume as well.

Since your database is going to be 2GB; and you should keep at least 2 weeks worth of backups, we can assume (given a naive backup regimen), that you'll need the following for EBS instances (Amazon's virtual disk drives):

6 GB - Data Volume
6 GB - Log Volume 
30 GB - Backup Volume 
80GB - System Drive 

SQL Server takes up about 32-40GB with Windows and its logs; I'm leaving room for a swap file, IIS, and any temporary files). Since this is Web Edition, you can't compress your backups to save space, that's partly why the Backup volume is so high. You could splurge, spend a few hundred on SQL Backup, and be able to do a Weekly Full, Nightly Diff, and Log Backup every 20 minutes, and that may save some money; but not enough to be worth it (in your instance).

So the EBS volumes will run $.10 / month per GB; or in this case:

   2015         2018     

    .60         Unchanged
    .60
   3.00
+  8.00
-------
  12.20

That's just for EBS.

You could cut that price in half by choosing magnetic instead of SSD; but it wouldn't change the calculus much -- your cost is in the instance itself; not in the EBS volume IO.

This also assumes you're using a public EC2 instance with a public IP and hostname; not that you're using a proxy server and hiding your webserver and SQL Server behind that proxy. You'll pay more for that. You'll also pay more if you want to take snapshots of your images or EBS volumes and store them in S3 ($.03 / GB).

None of this includes any actual bandwidth costs.

The minimum you could do this for would be $220 / month, and that's assuming little to no traffic. It'd probably be closer to $250 a month under actual usage.

If you decided to dump managing your own SQL Server instance, it could possibly be cheaper. You would only need one EC2 instance for your Web Tier, and a SQL Server RDS instance. Here's that cost:

Linux T2.Micro + SQL Server RDS

Linux T2.Micro (Web Tier):

    2015         2018    

    .013        .0116
 x   731     x    731    
 -------     --------
   9.013         8.47   

EBS Volume (System + Web, 1 volume):

   2015      2018   

     10      unchanged
x   .10
-------
   1.00

(That assumes you'll only need 10GB for your Linux distro + Web files)

SQL Server RDS:

       2015        2018   

db.t2.micro     db.t2.micro 

       .022        .022
   x    731    x    731   
   --------    --------
      16.08       16.08       

So you'd still pay $26.09 / monthly (more like $30 monthly, for fudge factor).

These prices are for US-EAST-1. The cheapest currently for RDS is Ireland-EU. Here are those prices:

Linux T2.Micro + SQL server RDS (Ireland-EU)

   2015       2015         2018       2018
    RDS        EC2          RDS        EC2
    
   .018       .014         .023      .0126
 x  731     x  731       x  731    x   731 
 ------     ------       ------      -------
  13.16      10.23        16.81       9.21  

Add in EBS volume costs; and you're looking at around $26-27 a month (including bandwidth). So this is by far your cheapest option if you stay with SQL Server.

If you decide to ditch SQL Server (And stay in Ireland-EU AZ), and go with the cheapest Database server option for RDS (mySQL):

Linux T2.Micro + MySQL RDS (Ireland-EU)

       2015            2018  
db.t2.micro     db.t2.micro     
                                      
      0.018        unchanged  
   x    731
   --------
      13.16

So it appears that if you stay in the EU, the price for SQL Server and MySQL on RDS are the same. Subtract $0.73 per month for US-East-1 Pricing with MySQL on RDS).

You could reduce this cost even further if you elected to go with an in memory DB like SQLLite. You'd need a larger EBS volume (I'd Double it), but that'd only increase your cost by $1.00 per month, and you could meet your criteria and only pay for a Linux t2.micro:

Linux T2 Micro (Web Tier) + SQLite DB:

    2015       2018 (EU-Ireland)
                   
    .013         .0126  
 x   731       x   731
 -------       -------
    9.50          9.21  
 +  2.00        + 2.00
 -------        ------
   11.50         11.21  

That would meet your criteria for hosting under $20 / month. There's no telling about performance, however.

VCSJones (on twitter) brought up SQL Server Express:

SQL Server Express / Windows 2012 R2 EC2 Instance

If you're absolutely wed to SQL Server (it's cool, I like SQL Server too), you could have a SQL Server Express instance, at that point you'd pay for the cost of the instance. SQL Server Express caps your database at 10GB.

     2015          2018  

 T2.Micro      T2.Micro
     .018         0.017
  x   731      x    731  
  -------      --------
  ~ 13.16       ~ 12.43  

Add in the same EBS numbers from above (12.20), and you have about $26 a month for pricing.

References:

Community
  • 1
  • 1
George Stocker
  • 57,289
  • 29
  • 176
  • 237
  • 1
    thanks for this outstanding response, very informative and helpful. Helps to point in the right direction. In terms of the SQL Server vs. MySQL, I am on the fence between the two and consider MySQL for cost purposes. I envision far down the road perhaps integrating the back-end database into another existing database on SQL Server, but perhaps I'll address that headache when it arises down the road. Thanks for helping me to refine my question, I hope this thread helps many others. – Declan Feb 03 '15 at 16:56
  • 1
    Consider also to [*schedule your instances on/off*](https://stackoverflow.com/a/38408077/4058484) when it is not required to run 24/7. – eQ19 Jul 18 '16 at 00:36