Owen::Thoughts::Blog

My Coding Laptop is Smaller, Faster, and Cheaper than Yours

November 17, 2020

Not my laptop …and it lives in an AWS Data Center!

I use an ephemeral AWS EC2 instance for development. It costs me less than $10 a year.

I have a desktop and smartphone. Getting a MacBook just for coding felt like overkill.

Architecture

Architecture Diagram of my Cloud Computing Development Environment.

Check out the code for this solution.

The secret sauce is a CPU Alarm that shuts the instance down if you aren’t using it.

Cost

EBS-$0.10 / GB month

EC2-$0.0104 / hour

Cost was a big consideration for me when designing and using this system. This solution is free under AWS Free Tier, but that doesn’t last forever.

As seen below, if you terminate your instance when you are done using it, you’ll run a little over $0.01 an hour. It’ll run you $0.46 a week at 40 hours a week, $1.84 a month, and $22.10 a year, all assuming you are running the instance for 40 hours a week.

# A month has ~720 Hours
>>> hourly_ebs_cost = 8*0.10/720
>>> hourly_ebs_cost
0.0011111111111111111
>>> hourly_instance_cost = 0.0104
>>> total_hourly_cost = hourly_instance_cost + hourly_ebs_cost
>>> total_hourly_cost
0.01151111111111111111
# 1.15 ¢ hourly cost
>>> weekly_cost = total_hourly_cost * 40
>>> weekly_cost
0.46044444444444443
# At 40 hours a week, you'd spend $0.46
>>> monthly_cost = weekly_cost * 4
>>> monthly_cost
1.8417777777777777
# A month's usage at 40 hours a week, $1.84
>>> yearly_cost = monthly_cost * 12
>>> yearly_cost
22.101333333333333
# A year's usage at 40 hours a week, $22.10

Portability

I use a free version of Terminus on all my devices. I can’t recommend Terminus enough, it is a fantastic product.

Using cloud computing also lets me centralize all my secrets. I don’t need to make a new IAM User or API Keys for myself when I get a new machine.

Experimenting

Python Environment XKCD Comic

Treating my development machines as Cattle instead of Pets lets me experiment freely.

I never have to worry about breaking my python environment.

AMD64 vs ARM64

This tweet brought up an interesting point, with new Mac Laptops running on ARM CPUs, local testing becomes more complicated.

The impending Dockerpocolypse. Specifically I realized with a mixed architecture k8s cluster that finding images that work on both amd64 and arm64 is not as easy as I’d hope. So what happens when Macs start shipping arm chips?

Using cloud machines for local development could help alleviate this issue.


Written by Owen Collier-Ridge who lives and works in Washington D.C building things in clouds and playing games. You should check out his personal site.