How to get a Free Server for a Machine Learning model
By: Roman Orac
Tags: Machine Learning, Cloud Computing, Free, Data Science, Tutorial

How to get a Free Server for a Machine Learning model

A 10 step tutorial on how to start and configure a free server anywhere in the world Roman Orac Apr 13·5 min read

Photo by Paul Hanaoka on Unsplash

Having an always-on server is a great way to show your references to your future employers or to test your Machine Learning model in the real world.

Before we start I would like to disclose that I’m NOT affiliated with Amazon in any way. The approach you’ll learn in this article should be also applicable to other cloud providers (eg. Microsoft Azure, Google Cloud Platform).

I wrote this article because I feel it is important that you have this knowledge. I wish someone would teach me this in my college days when I had too much time and no money.

By reading this article you’ll learn:

What is AWS?

How to create an AWS account?

How to start a free server anywhere in the world?

How to configure the server?

How to connect to the server?

Few tips on how to write the server code.

What is AWS?

Photo by Daniel Eledut on Unsplash

Amazon Web Services (AWS) is a subsidiary of Amazon providing on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis.

These cloud computing web services provide a variety of basic abstract technical infrastructure and distributed computing building blocks and tools. AWS offers reliable, scalable, and inexpensive cloud computing services all around the world.

AWS has a special offer for new users. You can run a small server instance for free for 1 year.

1. Create an AWS account

Start by creating an Amazon Web Services account. You will need a credit card to register. It can take some time to get verified.

2. Log in to AWS

Sign in to your AWS account. Select EC2 in AWS Management Console.

AWS Management Console (image by the author).

3. Setup the Instance

Click on the Launch Instance button. Choose an Amazon Machine Image (AMI):

Select Amazon Linux 2 AMI (HVM), SSD Volume Type Choose an Instance Type:

General purpose t2.micro Free tier eligible Click Review and Launch. Review Instance Launch:

Click Launch Select an existing key pair or create a new key pair:

In Choose an existing key pair select box select: Create a new key pair.

In Key pair name type: my-model.

Click Download Key Pair and Launch Instances.

Select key pair dialog (image by the author).

4. Connect to the Instance

Click on the View instance button. Open the terminal on your personal machine (Command Prompt if you are using Windows) and locate your key that you downloaded before (Download folder). To move to Downloads folder in the terminal run:

cd Downloads

Terminal with cd command (image by the author).

3. Set permissions for your key (skip this step if you are using Windows):

chmod 400 my-model.pem

4. Wait that your instance gets to running state:

Wait that your instance gets to running state (image by the author).

5. Connect to server

1. Select the instance and click the Connect button (remember the instance IP as you will need it later on).

Connect to your instance (image by the author).

2. On personal machine’s terminal window: copy the command for connection from Example (you see this example when you click on Connect button) on AWS and paste it to the terminal on your personal machine to connect to AWS instance: It should look something like this:

ssh -i "my-model.pem" ec2-user@XX-XX-XXX-XX.compute.amazonaws.com

Type yes if asked: Are you sure you want to continue connecting (yes/no)?

When successfully connected to AWS instance, you should see this ASCII art:

Connect to AWS server (image by the author),

7. Update the Server

Update instance if necessary: sudo yum update -y .

8. Open ports

If you plan to run a web server on the instance make sure you open inbound ports so that you will be able to access it from a web browser. In the example below, I open ports 5000 which is for the Flask Web framework.

Click Services, select EC2, select Running instances and scroll to the right and click on the Security Groups link of your instance:

Edit inbound rules as shown on the image below and click Save (image by the author).

9. Deploy Analytics Web Server

An empty server is not much better than no server.

To deploy a Data Analytics Server based on pandas, see:

10. Deploy a Machine Learning model to Server

Your 1st Machine Learning Model in the Cloud (image by the author).

A real-world project in production is worth more than a certificate from an online course. That is the reason I’ve written Your 1st Machine Learning Model in the Cloud.

The Your 1st Machine Learning Model in the Cloud will teach you how to develop and deploy a Machine Learning model to a server in the Cloud.

Before you go

Some of the links above are affiliate links and if you go through them to make a purchase I’ll earn a commission. Keep in mind that I link courses because of their quality and not because of the commission I receive from your purchases.

Follow me on Twitter, where I regularly tweet about Data Science and Machine Learning.