Running Folding@Home...in the cloud
Tags: pulumi, aws, azure, typescript
Published: 2021-01-19 21:35:37

You've probably read about Folding@Home in 2020 and its role in the drug discovery for treating COVID-19.

> To help tackle coronavirus, we want to understand how these viral proteins work and how we can design therapeutics to stop them.
>
> *https://foldingathome.org/diseases/infectious-diseases/covid-19/*

All over the world people were running F@H to support their call to [fight the virus with computing power](). And [the world responded](https://blogs.nvidia.com/blog/2020/04/01/foldingathome-exaflop-coronavirus/) to this call. There were many notable organizations ([CERN](https://home.cern/news/news/cern/cern-contributes-computers-combatting-covid-19), [EVGA](https://stats.foldingathome.org/team/111065), [AWS](https://stats.foldingathome.org/team/238068), [NVIDIA](https://stats.foldingathome.org/team/259918) and [more](https://stats.foldingathome.org/teams-monthly)!) running the Folding@Home client on their machines, thus donating spare cycles for a good cause. For this effort, the team behind F@H put out a special call. They were asking people with dedicated GPU hardware to run the client.

Unfortunately, for those of us who don't keep up with the world of gaming PCs anymore or simply do not have access to high-end GPUs, all we could do is run the F@H client on our regular machines. It was (and still is!) a good way to help them in their efforts.

For me, the solution was the public cloud providers. If I can't buy one, I'll rent one. In my case, I ran high-end instances on AWS and Azure for several months back in 2020. But there was no way I would be able to afford running those machines at their full price.

Enter Spot Instances. The big 3 cloud providers all allow users to run workloads on machines that have unused capacity. Sometimes at a whopping 80% discount on the hourly pricing! This means one can run high end machines at a fraction of the hourly price depending on availability in a certain data center (region). I have been able to amass quite a few [points](https://stats.foldingathome.org/donor/66949740) on F@H and climbed up the ranks quickly. From being nowhere on the leaderboards to somewhere in the top 30k (my rank has slipped quite a bit since I haven't run any work units in sometime) in a matter of few months. This is due to the way their system credits clients running high priority work units specifically designed to use GPUs.

After running this infrastructure for several months last year, **I am proud to announce that I am open-sourcing the very application that will allow _you_ to run Spot Instances on AWS or Azure as well.** It comes complete with the Pulumi app, as well as GitHub Actions workflows to automate the whole thing. All you need to do is, to configure the cloud credentials on GitHub and set some configuration for Pulumi.

There is a lot to explain in the Pulumi app, but I hope to do another follow-up post on this topic. My hope is for you to get started on protein folding in the cloud in less than 10 minutes. I have tried to add as much details as I can in the README. But don't be shy if you have questions. Ask me! :)

{% github praneetloke/foldinginthecloud no-readme %}

I am open-sourcing this because F@H does important research. They grew in popularity in 2020 due to COVID-19. But they do a lot of [other](https://foldingathome.org/diseases/) research too! You should definitely read more about them.