This page looks best with JavaScript enabled

Running Folding@Home on AWS with AWS CDK

 ·   ·  β˜• 3 min read  ·  ✍️ Sathya · πŸ‘€... views

Folding@Home(aka FAH) is a distributed computing project. To quote from their website,

FAH is a distributed computing project for simulating protein dynamics, including the process of protein folding and the movements of proteins implicated in a variety of diseases. Folding@Home involves you donating your spare computing power by running a small client on your computer. The client then contacts the Folding@Home Work Assignment server, gets some workunits and runs them, You can choose to have it run when only when your system is idle, or have it run all the time.

While I used to run FAH long, long back - dating back to my forum days, I eventually stopped due to lack of proper computing equipment. Recent events with the COVID-19 situation and FAH’s projects around it (see Coronavirus - What we’re doing and COVID-19 Small Molecule Screening Simulation for details) and the relatively powerful computer I built recently meant that I could run FAH on my desktop computer.

Now, I had some extra credits for AWS that were to expire soon and I figured instead of letting them go to waste, I thought to myself maybe I could spin up some EC2 instances and run Folding@Home on them. I started looking at the pricing of the GPU instances - and they were a bit pricier than what I could sustain. Considering this, I selected the c5n.large instance as I didn’t need instance and EBS-backed disks would be handy in setting up aa Auto Scaling Group.

To reduce expenses further, I started looking at Spot prices and it turned out, the spot prices were about 68% cheaper as compared to the on-demand prices. Since we don’t really care about what happens when the spot termination happens and the ASG will bring the instance count back up, I went with this option.

Spot savings as compared to On-Demand

The spot pricing trend revealed that the prices had remained stable and just to ensure the spot bids would be fulfilled, I kept the max spot price couple of cents more than the maximum price going then. Initially, the instances were brought up by manually launching them from the AWS Console. Since long I’d been meaning to use AWS CDK, this was the perfect opportunity to learn and try to use it.

The CDK code will bring up a new VPC,a couple of subnets, an ASG and attach a security group to allow for SSH into the instance. The code is not the best, there’s a bunch of hard-coding of regions, AMIs, SSH key names, but pull requests to clean up and make it more generic is more than welcome! Check out the code on my GitHub Repo

Share on

Sathyajith Bhat
Author, AWS Community Hero and DevOps Specialist

What's on this Page