Skip to content

AWS: EC2 Costing and Memory Constraints

Charlie Martin edited this page Sep 23, 2016 · 4 revisions

AWS pricing is available for various instance combinations.

For their cheapest Linux instance, some costs are:

Type Processors Memory (GiB) Per Hour Per Day
t2.micro 1 1 $0.013 $0.31
t2.small 1 2 $0.026 $0.62
t2.medium 2 4 $0.052 $1.25
t2.large 2 8 $0.104 $2.50

We are using t2.micro for chords.dyndns.org, and it has been working fine, with currently 655k measurements. This instance was based on the OpsWorks configuration, which uses Apache/Passenger.

t2.micro and t2.medium were tested with the CloudFormation template, which uses rails server. It turns out that the rails server bloats up significantly over time. After a day of usage, with about a few measurements per second, the t2.micro ran out of available memory, and had to be stopped/started. The server will then start with a small memory footprint again.

There are several messages here:

  • When running rails server, ssh in and monitor the size of the ruby process. Plan to start/stop occasionally. It might make sense to just do a daily cycle.
  • We have switched to the CloudFormation template to use Apache and Passenger, which are suited to operational usage. Have seen an instance which, after running for a few weeks, nginx returns a 502:Bad Gateway error. Suspect that there may be a resource issue here. Oddly enough, the OpsWorks instance which has been running for months, doesn't exhibit this behavior.
  • Also, the OpsWorks system sets up some swap space, although it's quite small. The CloudFormation template does not. Should we include swap space? Need to be somewhat careful that it doesn't incur significant disk fees.
Clone this wiki locally