Horizontal Scaling for an Embarrassingly Parallel Task: Blockchain Proof-of-Work in the Cloud
-
Create a AWS account and paste your credentials from account details into the
~/.aws/credentials
aws_access_key_id= Yourawsaccesskeyid aws_secret_access_key= Yourawssecretaccesskey aws_session_token= Yourawssessiontoken
-
Create a new security group based on your current ip address and change the security group name of
CND.py
to your security group name:SecurityGroups= ['YourSecurityGroups']
-
Create a S3 bucket to store log files
-
Install
Boto3
andFabric
pip install Boto3 pip install Fabric
-
Enter to the
Fabric
folder -
Run the following command:
fab -f CND.py start:T=200,D=2,N=8
(base) vpn-user-246-228:fabric shawvey$ fab -f CND.py start:T=200,D=2,N=8
[3.83.191.153] Executing task 'RunInstances'
[100.24.5.46] Executing task 'RunInstances'
[18.207.211.76] Executing task 'RunInstances'
[52.201.233.152] Executing task 'RunInstances'
[34.203.218.191] Executing task 'RunInstances'
[100.26.104.84] Executing task 'RunInstances'
[3.84.45.62] Executing task 'RunInstances'
[52.91.85.180] Executing task 'RunInstances'
[100.26.104.84] put: PoW.py -> PoW.py
[52.91.85.180] put: PoW.py -> PoW.py
[52.201.233.152] put: PoW.py -> PoW.py
[18.207.211.76] put: PoW.py -> PoW.py
[100.24.5.46] put: PoW.py -> PoW.py
[3.84.45.62] put: PoW.py -> PoW.py
[34.203.218.191] put: PoW.py -> PoW.py
[100.26.104.84] run: python3 -c 'import PoW;PoW.goldennonce(2,5)'
[52.91.85.180] run: python3 -c 'import PoW;PoW.goldennonce(2,7)'
[3.83.191.153] put: PoW.py -> PoW.py
[52.201.233.152] run: python3 -c 'import PoW;PoW.goldennonce(2,3)'
[18.207.211.76] run: python3 -c 'import PoW;PoW.goldennonce(2,2)'
[100.24.5.46] run: python3 -c 'import PoW;PoW.goldennonce(2,1)'
[3.84.45.62] run: python3 -c 'import PoW;PoW.goldennonce(2,6)'
[34.203.218.191] run: python3 -c 'import PoW;PoW.goldennonce(2,4)'
[100.26.104.84] run: python3 -c 'import PoW;PoW.goldennonce(2,13)'
[52.91.85.180] run: python3 -c 'import PoW;PoW.goldennonce(2,15)'
[52.201.233.152] run: python3 -c 'import PoW;PoW.goldennonce(2,11)'
[3.83.191.153] run: python3 -c 'import PoW;PoW.goldennonce(2,0)'
[18.207.211.76] run: python3 -c 'import PoW;PoW.goldennonce(2,10)'
[100.24.5.46] run: python3 -c 'import PoW;PoW.goldennonce(2,9)'
[3.84.45.62] run: python3 -c 'import PoW;PoW.goldennonce(2,14)'
[34.203.218.191] run: python3 -c 'import PoW;PoW.goldennonce(2,12)'
[100.26.104.84] run: python3 -c 'import PoW;PoW.goldennonce(2,21)'
[52.91.85.180] run: python3 -c 'import PoW;PoW.goldennonce(2,23)'
[52.201.233.152] run: python3 -c 'import PoW;PoW.goldennonce(2,19)'
[18.207.211.76] run: python3 -c 'import PoW;PoW.goldennonce(2,18)'
[100.24.5.46] run: python3 -c 'import PoW;PoW.goldennonce(2,17)'
...............
[34.203.218.191] out: Lucky num is 116, its hash is 00a722b0e1eab12e68928824ce82e5bc7cec6740e6cd0d3ffbe63260badc53fa
[34.203.218.191] out:
total runtime is 8.968298 seconds!
[34.203.218.191] download: /Users/shawvey/fabric/logs/Instance4.log <- /var/log/syslog
Warning: Local file /Users/shawvey/fabric/logs/Instance4.log already exists and is being overwritten.
...............
Done.