Skip to content

How to run Folding at Home on AWS EC2 Spot instances, and automate the install and config using Ansible

Notifications You must be signed in to change notification settings

dmhumph/Folding_At_Home_on_AWS_EC2_Spot_Instances

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Folding at Home on Amazon EC2 Spot Instances using Ansible to automate configuration of F@H and VNCserver to view your F@H Client!

This will walk through how to request the proper spot instance in AWS, then configure the instance to run Foldng at Home!

https://foldingathome.org/

Download this repo to use and modify for your information

git clone this repo to view, modify and run ansible playbook.

You will need some information for your client to use Fold at Home. https://apps.foldingathome.org/getpasskey. In the name field enter your username, and then enter your email where required. Your passkey will then be sent to the provided email address.

config.xml

We are provided a default config.xml that you will edit.

  • Add yourpasskey and yourusername to the config.xml where specified.
  • The team number is prepopulated with the Red Hat team, but you can edit this if you prefer something different.

foldathome_AWS.yaml

Make sure to go through the foldathome_AWS.yaml file and edit any fields needed.

  • Such as custom passwords
  • folder paths of where your config.xml and xstartup files are located on your host machine.

Request AWS EC2 Spot instance

Login to AWS Console first: https://aws.amazon.com/console/ and click on the "Sign in to the Console" button in the upper right of the screen.

Once logged in, type EC2 in the text box and hit enter. This will take you to your EC2 dashboard.

Now on the left side of the screen you will see a group called "Instances" under that there is a section called "Spot Requests" click on that.

Next, click on the Blue "Request Spot Instances" button.

  • On the next page select the far right radio button "Defined duration workloads" and the select the duration you would like... I typically go with 6 hours.
  • Now select tha Amazon AMI by choosing the "Search for AMI" button and search for "ami-0f7dbf59d7397e89d" and select Community AMIs. Then hit the "Select" button.
  • Now you want to choose your instance type by selecting "Change Instance type" button.
  • In the "Instance type" dropdown select "GPU instances" and then select the first check box for the instance type "g4dn.xlarge" This instance type provides a high power GPU for use on your Fold at Home work units.
  • Now hit the "Select" button. Now just accept the rest of the default values unless you need to change anything specific (Make sure you have the "Key pair" and if not generate a new one to use).
  • Now to finish click "Submit", which will issue your spot request and depending on availablity of that instance type it will be fulfilled.
  • Now go to your EC2 Dashboard and look at your instances, and you should see your running instance now there.

You will want to copy the "Public DNS (IPv4)" information so we can use with our Ansible playbook and ssh to the host.

Run the Ansible playbook

I run my playbook using Ansible tower, but it can be modified easily to run as a standalone playbook. Just make sure to edit the Hosts file in this repo and add your AWS EC2 instance DNS name to the file. Also update the included ansible.cfg with your AWS key pair location.

The playbook can now be ran:

ansible-playbook -i hosts foldathome_AWS.yaml

Once the playbook runs (takes about 5 minutes) it will install Fold at Home, configure it with your information, install VNC, and all the dependancies needed.

You may need to ssh to the host and sudo su - so you can be root and first kill vncserver:

vncserver -kill :1

And then restart the vncserver:

vncserver

Access your VNC session

Now use a VNC client and use your DNS name and port 5901 to connect to it. You will need to use your password from earlier in the configuration. Once logged in you can access the Folding at Home controler through the top left icon and under "Science".

If you can't access your host, you may need to check the security group and allow inbound/outbound traffic to allow VNC to work properly.

About

How to run Folding at Home on AWS EC2 Spot instances, and automate the install and config using Ansible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages