<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: RJ Hill</title>
    <description>The latest articles on DEV Community by RJ Hill (@theinfamousrj).</description>
    <link>https://dev.to/theinfamousrj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F72567%2Ff41e2f17-41be-40f8-9c23-279750f1f20a.jpeg</url>
      <title>DEV Community: RJ Hill</title>
      <link>https://dev.to/theinfamousrj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/theinfamousrj"/>
    <language>en</language>
    <item>
      <title>Fight Covid By Folding At Home (On A Budget)</title>
      <dc:creator>RJ Hill</dc:creator>
      <pubDate>Fri, 03 Apr 2020 16:04:10 +0000</pubDate>
      <link>https://dev.to/theinfamousrj/fight-covid-by-folding-at-home-on-a-budget-fel</link>
      <guid>https://dev.to/theinfamousrj/fight-covid-by-folding-at-home-on-a-budget-fel</guid>
      <description>&lt;h3&gt;
  
  
  Who is this for?
&lt;/h3&gt;

&lt;p&gt;Anyone and everyone. It's got tons of photos to show the step-by-step set up, the only part that's not covered is creation of an AWS account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Should We Do This?
&lt;/h3&gt;

&lt;p&gt;Simple. You want to participate in the eradication of COVID-19, but you don't have $800 to lay out on a &lt;a href="https://www.microcenter.com/product/610010/msi-geforce-rtx-2080-super-gaming-x-trio-overclocked-triple-fan-8gb-gddr6-pcie-30-video-card"&gt;nice video card&lt;/a&gt; and a massive electric bill.&lt;/p&gt;

&lt;p&gt;You've got three options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://foldingathome.org/about/donate/"&gt;Donate to Folding At Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://foldingathome.org/start-folding/"&gt;Run you some WU's (Work Units) on your current machine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Run you some WU's (Work Units) in the cloud on a budget&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is about that last item. A short story and then on to the real work!&lt;/p&gt;

&lt;h3&gt;
  
  
  The Story
&lt;/h3&gt;

&lt;p&gt;I spun up a giant 30-task cluster on ECS &lt;a href="https://github.com/richarvey/FoldingAtHome"&gt;following this tutorial&lt;/a&gt;. The CPU cluster I created didn't do nearly as much work as I hoped it would on the Folding at Home project and it cost me around $300 for the month. The entire cluster of CPU's net me about 1M PPM (Points Per Month) where my home PC net me about 1.8M PPD (Points Per Day). If you do the math, two months of that cluster would get me close to the price of a GPU that could do that same work in half a day!  &lt;/p&gt;




&lt;h3&gt;
  
  
  Credits
&lt;/h3&gt;

&lt;p&gt;All credit must go to the two other humans that got me to this point:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/richarvey/FoldingAtHome"&gt;Ric Harvey&lt;/a&gt; and their F@H ECS tutorial&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://gergely.imreh.net/blog/2020/03/foldinghome-on-aws/"&gt;Gergely Imreh&lt;/a&gt; and their F@H EC2 launch template tutorial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I merely expanded on Gergely Imreh's tutorial in order to make it a little more friendly for beginners, which also made it &lt;strong&gt;much&lt;/strong&gt; longer. If you want the original, shorter tutorial, then go to the link above.&lt;/p&gt;




&lt;h3&gt;
  
  
  Let's Get to Work
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step 0: Get an AWS Account
&lt;/h4&gt;

&lt;p&gt;Go to the &lt;a href="https://console.aws.amazon.com/"&gt;AWS Console&lt;/a&gt; and either log in to your existing account or create an account.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Pick an Instance Type
&lt;/h4&gt;

&lt;p&gt;First thing I did was look at the pricing list for the cheapest GPUs on AWS:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jgR8wnkv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mfixzmoxkb8fz5tn2816.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jgR8wnkv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mfixzmoxkb8fz5tn2816.png" alt="Image of AWS G4 Instance Pricing List"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;g4dn.xlarge&lt;/strong&gt; is the one we're going to target as the spot price is around $0.16 per hour. That's pretty cheap as far as GPU time goes. Remember, we can run this  for a few hours and shut it off if we want / need to. Feel free to pick one that fits your budget. You could even do multiple instances if you wanted to.&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 2: Create a Launch Template
&lt;/h4&gt;

&lt;p&gt;Once you're logged in to your AWS account, head over to the &lt;a href="https://console.aws.amazon.com/ec2/v2/home?"&gt;EC2 service page&lt;/a&gt;. Everything I do will be in the &lt;strong&gt;us-east-1&lt;/strong&gt; (N. Virginia) region, but you can look in &lt;strong&gt;us-east-2&lt;/strong&gt; (Ohio) for potentially cheaper prices. The template creation will be 90% of the work. Once you're done with this you should be able to launch a bunch of instances with this template, although you may have to &lt;a href="https://console.aws.amazon.com/ec2/v2/home?#Limits:"&gt;request a limit increase for spot instances&lt;/a&gt; if you go wild.&lt;/p&gt;

&lt;p&gt;Click &lt;a href="https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchTemplates:"&gt;Launch Templates&lt;/a&gt; on the left in the menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fUTkvWoq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/93bzv9g5aesiaffq52og.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fUTkvWoq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/93bzv9g5aesiaffq52og.png" alt="Image of Launch Template menu item"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click on the &lt;a href="https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#CreateTemplate:"&gt;Create launch template&lt;/a&gt; button in the upper right area of the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nd8uGAaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q2sujqa2zxrfnk9441v4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nd8uGAaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q2sujqa2zxrfnk9441v4.png" alt="Image of Create launch template button"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Template Name and Description
&lt;/h5&gt;

&lt;p&gt;The first area you'll see is the &lt;em&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/em&gt;, &lt;em&gt;&lt;strong&gt;description&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;tag&lt;/strong&gt;&lt;/em&gt; section. Fill this out however you want to, include tags if you feel like tracking your billing in a more granular fashion.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pexJWgGa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pmismiixiakmx14q1bzx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pexJWgGa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pmismiixiakmx14q1bzx.png" alt="Image of Launch Template name description and tag selection boxes"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Amazon Machine Image
&lt;/h5&gt;

&lt;p&gt;Now we have to choose the AMI. I've chosen to go with the &lt;strong&gt;Ubuntu Server 18.04 LTS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HRsr2Zxv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/awud98yweom0azqpn3gv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HRsr2Zxv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/awud98yweom0azqpn3gv.png" alt="Image of AWS Machine Image selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Instance Type
&lt;/h5&gt;

&lt;p&gt;I'm going for the &lt;em&gt;least&lt;/em&gt; expensive GPU option here: &lt;strong&gt;g4dn.xlarge&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z5F3b6f---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lo6783uhmfg5ws0f4kgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z5F3b6f---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lo6783uhmfg5ws0f4kgk.png" alt="Image of AWS Instance Type selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Key Pair Section
&lt;/h5&gt;

&lt;p&gt;If you already have a key pair or you don't plan to connect to this box via SSH, you can skip this and go to the next section. However, if you do want to connect to your instances, click the link that says "&lt;a href="https://console.aws.amazon.com/ec2/v2/home?#KeyPairs:"&gt;Create new key pair&lt;/a&gt;."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nd7vURxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fypob6isu1s0dn9pr4ny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nd7vURxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fypob6isu1s0dn9pr4ny.png" alt="Image of key pair selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h6&gt;
  
  
  Create a Key Pair
&lt;/h6&gt;

&lt;p&gt;You'll see a new tab open with the key pair main screen. Click the &lt;a href="https://console.aws.amazon.com/ec2/v2/home?#CreateKeyPair:"&gt;Create key pair&lt;/a&gt; button in the top right area of the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---DM_VUOT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fl97vpqgnqnfouih8izu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---DM_VUOT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fl97vpqgnqnfouih8izu.png" alt="Image of key pair main screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill this out with whatever &lt;em&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/em&gt; you wish, select the &lt;strong&gt;pem&lt;/strong&gt; radio button and click the Create key pair button in the lower left. This will download a pem file on to your computer for later use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kocfrloo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gbntk5u1ulfvq5f6zoe7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kocfrloo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gbntk5u1ulfvq5f6zoe7.png" alt="Image of key pair creation screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you finish, head back to your original tab and click the small refresh icon next to the drop-down. Your key will now appear in that box, select it and move on to the next section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nd7vURxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fypob6isu1s0dn9pr4ny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nd7vURxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fypob6isu1s0dn9pr4ny.png" alt="Image of key pair selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Network Settings
&lt;/h5&gt;

&lt;p&gt;Here we have a bunch of options. I'm going with the &lt;strong&gt;EC2-Classic&lt;/strong&gt; for ease of use, as well as the &lt;strong&gt;us-east-1a&lt;/strong&gt; Availability Zone. We will need to create a wide open Security Group for this so we can attach our local F@H client to it in order to watch our progress. This is not best practice, but it's &lt;em&gt;easy&lt;/em&gt; and we won't have this instance for too long.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--399oTPmo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ua2nk9bf548po36vzw3l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--399oTPmo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ua2nk9bf548po36vzw3l.png" alt="Image of Network Settings selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h6&gt;
  
  
  Create a Security Group
&lt;/h6&gt;

&lt;p&gt;Duplicate your current tab, switch to that tab, and click the &lt;a href="https://console.aws.amazon.com/ec2/v2/home?#SecurityGroups:"&gt;Security Groups&lt;/a&gt; menu item on the left. You'll be presented with the screen below. Click the Create security group button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PQiLQ1ef--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qvg3tv4i9i5hl3j337t7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PQiLQ1ef--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qvg3tv4i9i5hl3j337t7.png" alt="Image of Security Group main screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When creating a Security Group we can name it whatever we want and give it any sort of description we want as well. Leave the VPC drop down alone and scroll down to the &lt;strong&gt;Inbound rules&lt;/strong&gt; and &lt;strong&gt;Outbound rules&lt;/strong&gt; sections.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e1Q0As5t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8x01sbmni1l4b9ijj0qm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e1Q0As5t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8x01sbmni1l4b9ijj0qm.png" alt="Image of Security Group creation screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the first drop-down in the Inbound rules section to &lt;strong&gt;All traffic&lt;/strong&gt; and change the Source drop-down to &lt;strong&gt;Anywhere&lt;/strong&gt; and leave the Outbound rules as they are. Click the Create security group button and we're done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EAYdgc9k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uyr7nlmrwnzgor56e05g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EAYdgc9k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uyr7nlmrwnzgor56e05g.png" alt="Image of Security Group inbound and outbound rules"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Head back to your original tab and click the refresh icon in the Network Settings area. Your security group should now appear when you click the drop-down box. Select that and we can move on.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--399oTPmo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ua2nk9bf548po36vzw3l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--399oTPmo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ua2nk9bf548po36vzw3l.png" alt="Image of Network Settings selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Storage
&lt;/h5&gt;

&lt;p&gt;Leave the Storage area alone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qpXCOut6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x1q1m56ial4t2dkq86zd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qpXCOut6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x1q1m56ial4t2dkq86zd.png" alt="Image of Storage selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Instance Tags
&lt;/h5&gt;

&lt;p&gt;Add instance tags if you want. Again, this is simply a good way to sort things, especially in the billing section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---eg88D87--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1jowiiwwb84yc6dh9bn7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---eg88D87--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1jowiiwwb84yc6dh9bn7.png" alt="Image of Instance Tags selection box"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Advanced Details
&lt;/h5&gt;

&lt;p&gt;Now we're in final steps! Check the &lt;em&gt;&lt;strong&gt;Request Spot Instances&lt;/strong&gt;&lt;/em&gt; checkbox. You can let AWS control your bids for spot instances or control the bids yourself, that's up to you. I really want to minimize my expenses so I will click &lt;strong&gt;customize&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cxPuVfaD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mz4go0v6wv7xnpka2god.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cxPuVfaD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mz4go0v6wv7xnpka2god.png" alt="Image of Advanced Details box expanded and Request Spot Instances checkbox checked"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I want to set my price to around the &lt;strong&gt;minimum&lt;/strong&gt; for the spot instance, so &lt;strong&gt;0.16&lt;/strong&gt;. I'm going to set the Request type to &lt;strong&gt;Persistent&lt;/strong&gt;, and the Interruption behaviour to &lt;strong&gt;Stop&lt;/strong&gt;. You could probably use &lt;strong&gt;hibernate&lt;/strong&gt; here, but again, these won't be here forever. Now scroll all the way down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ke66gnQt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0l14q2n699uia3c7gzio.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ke66gnQt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0l14q2n699uia3c7gzio.png" alt="Image of top third of Advanced Details filled out"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only other field we'll need to fill out is the &lt;em&gt;&lt;strong&gt;User data&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tfb8yHK_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a20ityvrp1o647x8a07l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tfb8yHK_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a20ityvrp1o647x8a07l.png" alt="Image of lower third of Advanced Details filled out"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take the following script, put it into an editor, and fill out the &lt;em&gt;&lt;strong&gt;&lt;a href="https://foldingathome.org/support/faq/points/passkey/"&gt;passkey&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;, &lt;em&gt;&lt;strong&gt;&lt;a href="https://stats.foldingathome.org/teams"&gt;team&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;, and &lt;em&gt;&lt;strong&gt;user&lt;/strong&gt;&lt;/em&gt; values. This data will all come from &lt;a href="mailto:F@H"&gt;F@H&lt;/a&gt;. The &lt;em&gt;&lt;strong&gt;allow&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;web-allow&lt;/strong&gt;&lt;/em&gt; tags are for allowing a specific IP access to connect to this instance and monitor it - most likely your IP at your house. The &lt;em&gt;&lt;strong&gt;password&lt;/strong&gt;&lt;/em&gt; will be the password you use when connecting to the instance to monitor it - you make this up. After editing this, copy it all and paste it into the &lt;em&gt;&lt;strong&gt;User data&lt;/strong&gt;&lt;/em&gt; input box and click the Create launch template button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;DEBIAN_FRONTEND&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;noninteractive
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-qy&lt;/span&gt; nvidia-headless-435 ocl-icd-opencl-dev expect

wget https://download.foldingathome.org/releases/public/release/fahclient/debian-testing-64bit/v7.4/fahclient_7.4.4_amd64.deb
&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; /etc/fahclient/ &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;true
sudo chmod &lt;/span&gt;777 /etc/fahclient
&lt;span class="nb"&gt;cat&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt; &amp;gt; "/etc/fahclient/config.xml"
&amp;lt;config&amp;gt;
  &amp;lt;!-- Client Control --&amp;gt;
  &amp;lt;fold-anon v='true'/&amp;gt;

  &amp;lt;!-- Folding Slot Configuration --&amp;gt;
  &amp;lt;gpu v='true'/&amp;gt;

  &amp;lt;!-- Slot Control --&amp;gt;
  &amp;lt;power v='full'/&amp;gt;

  &amp;lt;!-- User Information --&amp;gt;
  &amp;lt;passkey v='111222333444555666777888999000AA'/&amp;gt;
  &amp;lt;team v='111111'/&amp;gt;
  &amp;lt;user v='YOUR NAME'/&amp;gt;

  &amp;lt;!-- Folding Slots --&amp;gt;
  &amp;lt;slot id='0' type='CPU'/&amp;gt;
  &amp;lt;slot id='1' type='GPU'/&amp;gt;

  &amp;lt;allow&amp;gt;YOUR.IP.ADDR.HERE&amp;lt;/allow&amp;gt;
  &amp;lt;web-allow&amp;gt;YOUR.IP.ADDR.HERE&amp;lt;/web-allow&amp;gt;

  &amp;lt;!-- Remote Command Server --&amp;gt;
  &amp;lt;password v='YOURawesomePASSWORDhere!'/&amp;gt;
&amp;lt;/config&amp;gt;
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt; &amp;gt; "/home/ubuntu/install.sh"
#!/usr/bin/expect
spawn dpkg -i --force-confdef --force-depends fahclient_7.4.4_amd64.deb
expect "Should FAHClient be automatically started?"
send "&lt;/span&gt;&lt;span class="se"&gt;\r&lt;/span&gt;&lt;span class="sh"&gt;"
# done
expect eof
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /home/ubuntu/install.sh

&lt;span class="nb"&gt;sudo&lt;/span&gt; /home/ubuntu/install.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h5&gt;
  
  
  Template Creation Completion
&lt;/h5&gt;

&lt;p&gt;You should then see this success message. Click the View launch templates button or go directly to &lt;a href="https://console.aws.amazon.com/ec2/v2/home?"&gt;your EC2 dashboard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JWpDQ48o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dvap1zaehznr4u03xmuu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JWpDQ48o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dvap1zaehznr4u03xmuu.png" alt="Image of Launch Template creation success screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should see the Launch Instance button, when you click it you'll get a drop-down. Click on Launch instance from template.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bvwoneFP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cldlg6hz98toglogk5im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bvwoneFP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cldlg6hz98toglogk5im.png" alt="Image of Launch Instance button clicked showing drop-down menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Instance Creation
&lt;/h5&gt;

&lt;p&gt;It will bring you back to the Launch Instance page, but if you choose your custom launch instance, everything will be filled out for you and you can scroll directly to the bottom and click the Launch instance from template button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZAfLjVw5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sre0p78aou7139ptmme1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZAfLjVw5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sre0p78aou7139ptmme1.png" alt="Image of Instance Tags filled out with Advanced Details not expanded"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Success
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;YOU ARE DONE!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go back to &lt;a href="https://console.aws.amazon.com/ec2/v2/home?#Instances:"&gt;your EC2 Instances&lt;/a&gt; and your instance(s) will be spinning up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AW2edNJf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jvc0suz2z4a17z80cl27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AW2edNJf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jvc0suz2z4a17z80cl27.png" alt="Image of running EC2 instance with IPs blurred out"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;With this setup, you should be able to get about 1M PPD per &lt;strong&gt;g4dn.xlarge&lt;/strong&gt; instance you create, should they run for 24 hours. I've seen them pull about 30k-50k PPH (Points Per Hour) depending on their mood. At $0.16 per hour, that's about 1875-3125 points per cent spent. &lt;/p&gt;

&lt;p&gt;If you were to purchase an RTX 2080 Super for about $800, assuming it's running 24/7 at ~254 watts, that's 6.1kWh per day. At $0.10 per kWh, that's $0.61 per day. By my horrible math, it would take about 89 days of full-time F@H in order for that purchase plus the electricity used to match the 1875 points per cent spent that you get with AWS G4 instance.&lt;/p&gt;

&lt;p&gt;I know there are a bunch of other things we can be doing to help with COVID-19, this post is simply one of those things. Stay strong, stay safe, continue social distancing, and do what you can to help out!&lt;/p&gt;




&lt;h3&gt;
  
  
  Extra Goodies
&lt;/h3&gt;

&lt;h4&gt;
  
  
  SSH Into Your Instance
&lt;/h4&gt;

&lt;p&gt;Since you're already on your &lt;a href="https://console.aws.amazon.com/ec2/v2/home?#Instances:"&gt;EC2 Instances page&lt;/a&gt; and you have your pem file in your downloads, click the button that says &lt;strong&gt;Connect&lt;/strong&gt;, at the top of your &lt;strong&gt;EC2 Instances&lt;/strong&gt; page. You should see a line that looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"fah-ssh.pem"&lt;/span&gt; ubuntu@ec2-11-222-333-44.compute-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open up your favorite terminal&lt;/li&gt;
&lt;li&gt;cd to your downloads directory&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;chmod 400 YOUR_FILE.pem&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;copy and paste that ssh command from your browser into your terminal&lt;/li&gt;
&lt;li&gt;run it &lt;/li&gt;
&lt;li&gt;follow the prompts and you will be logged in to your EC2&lt;/li&gt;
&lt;li&gt;profit?&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Installing and Running NVTOP
&lt;/h4&gt;

&lt;p&gt;Unfortunately &lt;code&gt;nvtop&lt;/code&gt; does not come pre-installed on Ubuntu until version 19 and we do not have access to Ubuntu 19.X, so we'll install &lt;code&gt;nvtop&lt;/code&gt; by hand and run it to see how our GPU is doing.&lt;/p&gt;

&lt;p&gt;Run the following string of commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;cmake libncurses5-dev libncursesw5-dev git &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
git clone https://github.com/Syllo/nvtop.git &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; nvtop/build &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;nvtop/build &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
cmake .. &lt;span class="nt"&gt;-DNVML_RETRIEVE_HEADER_ONLINE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
make &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;make &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;(yes you can copy-paste the entire thing at once)&lt;/p&gt;

&lt;p&gt;After that has completed, you should be able to run &lt;code&gt;nvtop&lt;/code&gt; from the command line and get a cute little graph of your GPU. Give it a little time to warm up and get a job from &lt;a href="mailto:F@H"&gt;F@H&lt;/a&gt;. You should see it spike up to 100% and maintain that workload for a while.&lt;/p&gt;

&lt;h4&gt;
  
  
  Trying Other Instance Types
&lt;/h4&gt;

&lt;p&gt;I tried getting this to work on the P2 instance types which are about &lt;strong&gt;8x as expensive&lt;/strong&gt; as the G4. I saw nothing in the performance of the P2 running F@H that would make me consider switching from the G4, it's just not worth it.&lt;/p&gt;

</description>
      <category>foldingathome</category>
      <category>covid19</category>
      <category>aws</category>
      <category>budget</category>
    </item>
  </channel>
</rss>
