Coding in the Cloud with AWS
Give your hardware (and sanity) a break by letting the cloud do the work for you
Amazon Web Services (alongside alternative options such as Azure, Google Cloud, and others) offer unprecedented access to virtual, fully remote processing power by harnessing virtual machine clusters and remote servers to handle enormous amounts of data, as well as process tasks and data science models that would otherwise bog down your local computer to a crawl. Instead of being left with nothing to do while your models run in the background for 12 hours, why not utilize cloud-based services to handle it for you?
I came into the Data Science program at Flatiron already utilizing AWS (as well as Paperspace) and Parsec for cloud-based gaming. This created the ability to utilize the physical locations of Amazon servers throughout the world to bypass delay-based net code by implementing a peer-to-peer connection with the server acting as an official waystation between players, minimizing lag to the levels of games with properly implemented rollback network services.
Computing and processing power for complicated Data Science models can be comparable — and even surpass — that of hardware-intensive games that put a strain on processors and GPUs. This article is here to help guide you through the setup process of creating an account and selecting the right virtual hardware package for your cloud computing needs.
AWS pricing is pretty straightforward. As an individual user, it costs me about $0.80 an hour to run my server, and storage for my virtual HDD as well as image storage (we’ll get to that later) costs me about $1.50 per month. Even with gaming for 2–3 hours each day in the cloud, I only pay about $10–15 monthly.
Setting Up Your AWS Account
Before being able to select the right virtual instance (the official AWS term is Elastic Instance or EC2) you need to first create an AWS account. In the event you already have an Amazon account (prime, kindle, etc.), you can go ahead and use that login information to sign-up for the service.
Once you’ve gone ahead and signed up, you will also need to request an increase of your CPU core limit, as this will give you the processing power necessary for your big-data needs. Note that it can take up to 24 hours for Amazon to approve your request, although this is only a formality.
The process for doing this is quite robust, and it is easy to get lost in the jungle of menus splattered everywhere. Don’t worry, however, as I’ve also included a great tutorial at the end that can guide you through the setup process.
After your CPU core limit request is approved, next is creating an Nvidia GPU Amazon Machine Image (AMI). This step is crucial, otherwise, you would need to log in as the core root user whenever running your server, which in itself carries huge data privacy and security risks. The AMI lets you access the server as an authorized administrative contributor (it’s like being on a team with yourself!).
Once you have your Nvidia GPU selected (you can never have too much power, so it’s okay to be liberal here), the next step is to launch the server from the AMI. An important note: AWS has recently launched Mac-based EC2 instances, powered by the Amazon Nitro System. The Mac-based EC2 instances give you the choice of macOS Mojave (10.14), macOS Catalina (10.15), and macOS Big Sur (11.2.1).
Launching your instance will include downloading a remote access API (need to do this every time you log in if using an AMI), and utilizing a randomly generated password. Although this step is annoying, the added security makes it worth it IMO.
Lastly, once you are inside your virtual machine and everything looks good, be sure to create an image so that you can boot in the future from an already configured state. AWS does not by default save your cloud settings and preferences on the AMI, so making an image and saving your work upon termination (always terminate your instance when done working!) is the one way you have to keep your settings intact and avoiding having to this setup process every time you log in to your instance.
That's it! Be sure to check out the detailed tutorial below in resources for step-by-step instructions on setting up an instance. Ignore the parts about Parsec, as that is specifically for online gaming, but other parts, including the GitHub repos in the video description, have code for optimizing Nvidia GPU settings and web access ports that can be beneficial for your processing and tuning needs.
AWS Setup Tutorial: https://www.youtube.com/watch?v=bNmaT31tllY
Text Step-By-Step Tutorial: https://www.richardneililagan.com/posts/create-game-server-aws-parsec
AWS Console: https://aws.amazon.com/console/
AWS EC2 Mac Instances: https://aws.amazon.com/ec2/instance-types/mac/
AWS Pricing Calculator: https://calculator.aws/#/
Nvidia GPU AMI Config: https://aws.amazon.com/marketplace/pp/NVIDIA-NVIDIA-Gaming-PC-Windows-Server-2019/B07STLTHM8
Nvidia & Parsec Cloud Script: https://github.com/parsec-cloud/Parsec-Cloud-Preparation-Tool
Activate Windows Script & Documentation: https://aws.amazon.com/premiumsupport/knowledge-center/windows-activation-fails/