Member-only story
Automating AWS Server Shut-Down for Deep Learning
Because everyone forgets sometimes and that's ok.
Lately, I have been working with an AWS EC2 server for a machine learning project. Every article I have come across has said the same thing… “Don't forget to shutdown your EC2 instance”. Reading this gives me anxiety. Just the thought of leaving a GPU on to burn a hole in my pocket makes me irrationally sweaty.
So I decided to make a Bash script to spin up a server, SSH in so I can work on my project, then shut down the server when I log out. I even saved a shortcut for the script on my Desktop so that I can start working with two clicks.
Unfortunately, the process to get the script working was not straightforward and mildly infuriating. So I decided to write a quick post so the community can have the same peace of mind.
*My work station is a Windows 10 PC, so these steps may be different for a Mac.*
Prerequisite 1: Have an AWS Account and Create an Instance
You will need to have an AWS account as well as have instantiated an AWS EC2 instance. FastAI has a tutorial on how to do this here. If this is your first time creating a GPU instance, you may have to request a limit increase for “p-type” instances. For me…