Spend a Buck and Learn


Posted by Ryan S. Brown on Sat, Dec 5, 2015
In General
Tags: costs, lambda, s3

At my first real job involving “The Cloud,” I was given a copy of Chris Moyer’s book, Building Applications in the Cloud. A lot has changed since then, I don’t know many projects using botoweb and marajo is still hosted on Google Code (deprecation alert!). The list of AWS offerings in 2011 are a pale shadow of what’s available today. One lesson really stuck though, and that is how cheap it is to experiment with cloud services.

In the introduction, Chris emphasized just how cheap AWS was compared to almost any other product consumers buy. Let’s look at what it costs to experiment with Lambda and some related services.

Price Anchoring

Pretend for a moment you’re a programmer, and you have a little bit of a sore throat (am I projecting?). You need some tea and some cough drops. Tea at Starbucks is $1.59 and cough drops are $3.49 at Walgreens. How much compute can that buy?

Well, if you want an EC2 instance, the t2.small is $0.026 USD per hour - so for the price of those cough drops you can get over 130 hours (5.5 days) of an EC2 instance.

Neat, and whatever you learn playing with EC2 will definitely have a higher long-term value than those cough drops (though at the moment, I’d certainly pay more than $3.49 to not be coughing my lungs out).

For Lambda, the prices are even lower. The environment with 128 MB of memory costs $0.000000208 per 100 milliseconds. That’s 208 nanodollars. Simplified, or complected, depending on your point of view, AWS Lambda compute time costs 162.5 femtodollars/byte-second. Femto, in scientific notation, is 10 to the negative 15th power – very very tiny.

A dollar would buy you 162,500,000,000,000,000 byte-seconds of compute, and the tea from Starbucks would get you 258,375,000,000,000,000 byte-seconds of the stuff. Ahh, the fun of the metric system.

But Wait There’s a Free Tier

In addition “I’m just testing” levels of usage being so cheap, there’s also the Free Tier. For free, you get a full month of t2.micro service, 5GB of S3, 25 GB of DynamoDB storage, 37 days of Lambda compute time for the 128 MB execution environment, 1 million SNS message publishes, and way, way more. Seriously, read the Free Tier page (make sure you hit “show all products”) and tell me that you playing with Lambda, API Gateway, or whatever else you want to try will send the repo men to your door.

Fun bonus fact: 3.2 million seconds is the amount of time it takes Mercury (yes, the planet) to complete 2/5ths of its orbit around the sun. Thanks WolframAlpha!

Even more bonus facts: 5 gigabytes is enough space for you to back up about 300,000 emails, or 1,200 PDFs of academic papers you tell yourself you’ll get around to reading someday (projecting again?).

Go Forth

If you don’t have an AWS account, go sign up for one and try out some examples (this blog has a couple to try). If you have one but don’t use it much because you’re afraid of a fat AWS bill showing up at the end of the month, set up billing alarms then go nuts.

Happy hacking! If you build something you want to show off, tweet @ryan_sb or email ryan@serverlesscode.com and I’ll be happy to feature it.

Tweet this, send to Hackernews, or post on Reddit