COMSM0010 - Cloud Computing - 'Golden Nonce' coursework
> python3 remote_runner.py -d 28 -n 8
Runs the system with Difficulty Level 28, over 8 remote hosts
> python3 remote_runner.py -d 28 -t 60 -n 0.8
Runs the system with Difficulty Level 28, runtime within 60 minutes, at a confidence level of 80%
> python3 remote_runner.py -d 28 -n 8 -timeout 360
Runs the system with Difficulty Level 28, over 8 remote hosts, timeout of 360 seconds
To run the remote_runner.py local script, it is necessary to setup AWS credentials for Boto3. Your Access key and Secret Key can be found in the AWS dashboard, you can opt to either use the default IAM user or create a new one for this system.
The recommended location storing AWS credentials for use with Boto3 is at ~/.aws/credentials, with the following file format:
[default]
aws_access_key_id=foo
aws_secret_access_key=bar
Inside the /utils directory we provide a CloudFormation JSON file for sepcifying the correct SQS queue structure. To create the queues (a one-time operation):
- Navigate to AWS CloudFormation
- Click "Create Stack"
- Leave "Template is ready" selected, and choose "Upload a template file"
- Upload
create_queues.json - Click "Next"
- Enter a stack name of your choosing, perhaps
CND - Click "Next" through the subsequent forms
- Finally, click "Create Stack"
This will initialise the queues correctly.
It is necessary to add these credentials to the remote machine image also. I have provided a template image containing: Python3, Boto3, and CND.py, but no credentials.
Follow these steps to create your personalised image:
- Locate the image with the id
ami-0cdc46a6bbb371a54, it will be called CloudNonceDiscoveryTemplateImage - Launch an instance of this image, using a KeyPair you have access to
- Once launched, SCP your local
~/.aws/credentials/to the same location on the remote machine - Save this as a private personal image (Instances, right-click > Image > Create Image)
- Change the
image-idinremote_runner.pyto reflect the one from step 4
This will allow your remote instances access to the SQS infrastructure we put in place previously.
The /lambda directory provides a SAM file (CloudNonceDiscovery.yaml), which specifies the configuration of the Lambda function. And also provides a lambda_function.py, the function itself.
Following the instructions provided here, will allow you to create the Lambda function with YAML file, before adding the Python manually after creation.
create_keypair.py: Allows creation of keypairs without using the AWS consoleinstance_starttime_tester.py: Used to investigate instance launch timesqueue_tester.py: Can manually add computation requests tocnd_queue.fifo