In this video, you'll learn how to install Jupyter on an Amazon Lightsail virtual server. Super simple, and pricing starts at $3.5 per month. Definitely worth a try :)
https://aws.amazon.com/lightsail/
Transcript
Hi, everybody. This is Julien from Arcee. In previous videos, we've run our Jupyter Notebooks on SageMaker Studio, SageMaker Notebook instances, EC2 instances, and on our local machine. Believe it or not, there's an option we haven't looked at yet: Amazon LightSail. Amazon LightSail is an AWS service that makes it extremely easy to create a virtual server and start using it in minutes. And I really want to say seconds because it's so easy. Let's see how with just a couple of clicks and a couple of command lines, we can fire up a Jupyter Notebook on an Amazon LightSail server. We'll see that this is possibly the most cost-effective option we can find. Let's do it.
Starting from the AWS console, we open LightSail. I'm using the Ireland region here, but you can use any region where LightSail is available, of course. It says good afternoon. That's a polite service. I like that. We can then proceed and create an instance. I'm going to stick to Linux. I don't need any of those apps. I'm just going to install the OS, and I'm going to use Amazon Linux 2. You can add a launch script, which is basically a shell script that will be executed as the instance starts. So I'm just going to update packages, install Python 3 and GCC C++ because one of the dependencies we're going to need for Jupyter requires a compiler. I'm also going to add git because you always need git. Let's not use the default SSH key pair. I'll show you how to use your own. Just click on "Create," name it "Jupyter demo," generate the key pair, and download it. Then I need to move this to the proper SSH directory and set access rights for it, making it readable by me only. Otherwise, it won't work.
Now let's see what instance type you can pick. Here, you can select from different criteria, but price is the most important for me now. I'm trying to find the least expensive option. This is the one: $3.5 per month, first month free. For this, I get half a gig of RAM, one vCPU, and 20 gigs of SSD storage, which should be enough for Jupyter notebooks. Let's see if we can fit all of that stuff in half a gig. Okay, so we go with this. Let's give a name to this instance, call it "Jupyter," and create it.
The instance is running, so now we just need to grab its IP address. We could connect using this browser-based thing, but I'm old-fashioned. I'd rather have a proper terminal. So we'll just grab the public IP and use the key we created. The username is ec2-user. And voilà! Let's check if Python 3 is installed. Yes. So we should have pip3 as well. Now we can just go and install Jupyter. Let's also install scikit-learn, NumPy, and Pandas, which I'm guessing we want to use. This only takes a few seconds. Now everything's installed, and we should be able to fire up our Jupyter notebook.
The default port is 8888, which means we need to open it. But don't worry, this is really simple. No need to worry about security groups and everything else. The LightSail console makes it very easy. We can simply add a rule and say, "I want to access 8888." By default, this will be accessible by everybody, which is probably not a great idea. I'll keep it that way for the demo, but you definitely want to restrict it to your own IP address or your company IP address range. Okay, create it. I could delete this HTTP port. I don't need it. I'll just keep SSH and my Jupyter port.
Now if I just grab the IP address and connect to port 8888, yep, I get to the Jupyter screen. I can just get the token and connect. Yep. Now we can create a notebook and check if we can import everything. Yep, this works. And obviously, we can open a terminal, use git, bring our code, and we're good. How much memory do we have left here? Oh, we have quite a lot. So yeah, we have enough memory to work definitely. We can see those 512 MB, and most of them are just in the buffer, but we can definitely work. You shouldn't have any problem running Jupyter on these tiny instances, so long as you're not loading gigabytes of data in your notebook. But for quick experimentation with a fraction of the dataset, it should be fine. And this is only going to be $3.5 a month.
So once we're done, of course, we could stop Jupyter. If we go back to LightSail, we can stop instances and, of course, delete them just like a normal EC2 instance. That's what I wanted to show you today. If you want a no-frills environment, very easy to set up, and if you don't want to work with SageMaker for whatever reason or think EC2 instances are too complicated, this is really the simplest way. Let me know what you think. See you next time. And until then, keep rocking.