This article was published as a part of the Data Science Blogathon.
Let’s You have a job crunching trillions of image data points to extract insights, and you don’t have sufficient storage or processing power to do it, so what will you do – Stop in the Middle or Get a system with Some Storage and Compute Power?
Well, if your answer is the second one, then you have a solution called cloud computing, and AWS (Amazon Web Services) is the best way to go due to the numerous features it provides:
So to summarise, even if you are doing what you want in some claimed machine, you don’t need to worry about security, computing, storage, and managing the device. You can also access it.
In Today’s article, we will discuss how you can set up your next jupyter instance on AWS for heavy data workloads. and later look into ways to be smart with AWS and end with some don’ts while using AWS. Overall, it will be a hands-on and fun-packed journey to travel. So let’s move on to the more practical side that any enthusiastic DS aspirant wants!
Instances are the VMs provided by AWS for usage. Each one has some user-defined – Type, OS, Storage, Networking, and Security. So now, let’s look practically at how each piece fits together!
Imp: Visit the AWS login page and log in to your account; click signup, fill in the required details, and verify to get a new profile with free tier eligibility.
1. Log in to your account, and in the console search bar, type EC2 and click it (The Elastic Cloud – Sevice).
2. Once in the instance window, select Launch Instance.
3. In the new window, fill in all the required details as follows:
Finally, launch the instance.
4. Once the launch is complete, go to View all instances on the next page and then check the status if it says check passed 2/2:
Result:
5. Finally, navigate to the folder you downloaded crucial and open the terminal. Select instance type, click Connect and go to SSH Client in the above. Now copy the code in the airport and press enter.
ssh -i "ubuntu_instance1.pem" [email protected]
Here “ubuntu_instance1.pem” is the key we downloaded. For mac, it’s a cer file.
The result looks like this: for windows.
So congrats, you have now your machine. Lets’s currently set up our notebook in the next section.
Note: – I have changed the instance (refer to command line😅) as there were some issues with the old one, but all process remains the same.
This section covers installing the jupyter-notebook, but the same process can be followed to add any dependency you may require for the job.
1. Before anything, update your environment packages – a safe check :
sudo apt update
sudo apt-get update
2. Once everything is sorted, add the below command to install the package using apt :
sudo apt install jupyter-notebook
3. Now open the notebook by calling:
jupyter notebook -ip 0.0.0.0 --no-browser
4. Now comes the most essential part – copy the given URL and replace it as:
http://127.0.0.1:8888/?token=a3e3b3aef98cfbb6159efd4a31a090d971a9611c5380952f
to
http://[Publicic IPv4 Address]:8888/?token=a3e3b3aef98cfbb6159efd4a31a090d971a9611c5380952f
in this case – 15.206.195.91. You can find it by selecting instances -> Details -> Public IPV4 addresses.
Output
Congo, you have successfully launched a jupyter notebook on AWS, and it was this easy!.
If you want to replicate your work with the same settings, you need to create new instances, which can be a tedious task and error-prone. So let’s be smart here and use AMI – Amazon Machine Image.
AMIs are just copies of your machine and have the same OS, Storage, Memory, process, Networking, and security configuration. Although its also allowed to change them as per convenience.
Here is how you can create AMI :
1. Head to the EC2 instance page and select Actions -> Image & templates -> Create image
2. Enter:
3. Now, finally click Create image button, and you are done:
Image By Author
Once done, you can select the AMI from Launch Instance -> My AMI’s Section and follow along from Setup & Launch Instances section:
Reference Image:
Although we have barely scratched the surface of AWS, using the method discussed, you can enhance your productivity by a lot. Here is a brief summary of whatever we have covered:
There are more services than discussed here. I hope you explore other services like AWS Lightsail, Lambda, VPC, Batch, Outposts, etc.
So this concludes today’s article, and I hope you have learned something and planning to apply it. You can share your suggestions & issues in the comments. Also, feel free to reach me on my LinkedIn, Twitter, and Github.
Finally, if this read added some value, consider sharing with others as sharing is caring!.
The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.