-
Notifications
You must be signed in to change notification settings - Fork 171
AWS Setup Guide
[Computer Setup]https://github.com/ProGamerGov/neural-style-pt/wiki/AWS-Setup-Guide#computer-setup
- What you need to do on your PC.
- Create an AWS account.
- Select an AMI in your desired region.
Terminating/Stopping Your AMI From Running
First download WinSCP: https://winscp.net/eng/download.php
Open up this link to download PuTTY: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Then scroll down to "putty.exe (the SSH and Telnet client itself)", and download either the 32bit or 64bit versions of PuTTY.exe (depending on your OS):
Navigate to:
C:\Program Files
And create a folder called PuTTY:
C:\Program Files\PuTTY`
Place putty.exe in this folder:
C:\Program Files\PuTTY\PuTTY.exe
If you do not have an AWS already, go to https://aws.amazon.com/, and click on "My Account" on the top right, and then select "AWS Management Console". Then create an account and sign in.
REMEMBER TO MAKE SURE THAT YOU HAVE NOT LEFT YOUR AMI RUNNING WHEN NOT USING IT, BECAUSE YOU ARE PAYING BY THE MINUTE/HOUR!
Use this site to find the desired Ubuntu version in the region (zone) you want: https://cloud-images.ubuntu.com/locator/ec2/
Pick your region based on wherever you think is cheapest and not whatever is closest to you. Make sure the region you pick has "p2.xlarge" spot instance available!
Then click on the "AMI-ID" of the AMI you want and it will take you to AWS' site. You are looking for an AMI that has: hvm:ebs-ssd
under "Instance Type", and amd64
under "Arch".
When you click on the links under AMI-ID, you'll be taken to this page (if you are already signed into AWS):
Click on "all Instance types" from the top left and select "GPU instances":
You'll now be shown this screen:
Scroll down and select "p2.xlarge" and then click "Next: Configure Instance Details":
You'll now see this page:
Click on the "Request Spot instances" checkbox, and put some like $1 for the "Maximum price", then click "Next: Add Storage":
You'll now see this page:
Change 8GB to something higher, like 32GB or 64GB, then click "Next: Add Tags":
Ignore this page. Click "Next: Configure Security Group":
You'll now see this page:
Under "Source" change "custom" to "My IP", then hit "Review and Launch":
Make sure everything looks good, and the click "Launch":
If you don't have an existing Key Pair, now is the time to create a new one:
Give your new key pair a name, and then download it:
Open up WinSCP:
Add "ubuntu" to the "User name" section, and then select advanced:
You'll now see WinSCP's advanced settings window:
Navigate to "authentication" by clicking the option on the left side of the window. Then click the 3 dots under the private key input section:
Now navigate to and select your private key that you previously downloaded from AWS:
Select "Yes" for converting your private key to PuTTY's format:
Save the newly converted private key:
Click "Okay":
Click "Okay":
Now select "Save" and you'll see this screen:
Give your new session a name:
Now go back to AWS and make sure that you have selected the key pair that you made, then click "Request Spot Instances":
You'll now see this screen. Click "View Spot Requests" on the right:
You'll now see this screen:
Click on "Instances" on the right hand side:
You'll now see this screen. Click on your instance:
Scroll down and look at the information in the bottom bar:
Copy the public IPv4 address:
And put that IPv4 address in your WinSCP session's Hostname:
Now you'll see this screen. Click "Login":
Once your AMI is fully booted, WinSCP will give you this message. Click "Yes":
You'll now see this screen. You can easily move files back and fourth between your computer and the AMI/server by simply dragging them from the left/right window in WinSCP to the other window in WinSCP:
Now click the two tiny PC screens with a lightning bolt in between them on the top left of WinSCP:
PuTTY should automatically boot up and login to your AMI. If there's a key warning message, click "Yes":
Sometimes AMIs can have issues when you first boot them, so I like to test for that with a simple and useless sudo apt-get install time
command:
This is the main issue I was checking for:
ubuntu@ip-Address:~$ sudo apt-get install time
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
Even if that command doesn't have any issues, it's still a good idea to reboot just encase. You should do this every time you boot up your AMI:
After you run the reboot command, PuTTY will stop working and give an error, letting you know it lost connection. Close the PuTTY window:
WinSCP will keep looking for the server until it's rebooted. If it stops, you can make it start again:
Now you can install whatever you want on your sever/AMI for later. If you wish to install neural-style-pt, check out the installation guide here: https://github.com/ProGamerGov/neural-style-pt/blob/master/INSTALL.md
I recommend the Github and pip or just simply the pip guide for installing neural-style-pt.
Once you have installed everything that you want on your AMI, you now need to save it. Every time you load up the AMI, it will be exactly like it was when you saved it. Nothing is saved unless you create a new AMI from the current AMI.
On the AWS console page, right click on your instance and navigate to "Create Image":
You'll now see this page. Make sure there's enough storage space:
Give the Image a name and description, so that you will know what it contains in the future. Then click "Create Image" in the bottom right:
You'll now see this page. Click "Close":
Your AMI is now saved!
Click on "AMIs" on the left panel:
Right click on the AMI that you want to launch and select "Spot Requests":
Now, when you start up your saved instance, it's pretty much just like before, only you don't have to make a new key pair:
You do however have to replace the Hostname in your WinSCP session with the new IPv4 address from your newly launched spot request.
If your AMI has previously been saved, terminating it will not delete it. You will only loose whatever you have done since saving/booting up your AMI.
On the Instances page, right click on your currently running AMI and select "Terminate":
You'll now see this page. Select "Yes, Terminate":