Deployment of a Machine Learning model into Amazon EC2(Part 2- Real-Time Deployment)
- In the previous article, we saw how to how to set up our server into Amazon EC2.
- We understood the setup of a Linux box.
- Now is the time to deploy a machine learning model into Amazon EC2.
- Hence, in this article, we will deploy a trained machine learning model into Amazon EC2.
- In order to do so, we will have to go through the following steps
Creating a Security Group:
- Now, we will have to set up the EC2 instance accessible from anywhere.
- In order to do so, go to the EC2 instance and select the security group.
- Click on Inbound and then click on add rule.
- Set the type of the rule to All traffic.
- In source Give permission for anywhere.
- Basically one can use it from anywhere with IPv4 and IPv6 network protocols.
Setting up the Network Interfaces:
- After setting up the security groups one should go to the network interfaces section.
- After that right-click on the interface and select change security groups.
Setting up the system dependencies:
- Now, we need to go back to the terminal and install the system dependencies in order to deploy our model.
- For that, we need to use the following command
pip3 install -r requirements.txt
- After running the command we can see that the system dependencies have been successfully installed.
- After that, in the terminal use the following command
- We can now see that, the app is running with port number 5000
Deploy into EC2:
- As the final step, we will have to go back to the EC2 instances in the AWS management console.
- From the instances, we will have to select the EC2 instance.
- After that, we will have to click on actions and click on connect.
- After that, we can see our URL.
- We will simply have to add the port number.
- Here, the port number is 5000 hence, we have added <The EC2 URL>/5000
- Open this entire link in a new tab and you can see your model live on Amazon Elastic Compute Cloud (EC2).
- In this article, we covered a high-level overview of how to deploy a machine learning model into Amazon EC2.
- In the next article, we will see how a high-level overview of Amazon S3.
- We will also understand how to run a jupyter notebook into the cloud using Amazon Sagemaker.
Final Thoughts and Closing Comments
There are some vital points many people fail to understand while they pursue their Data Science or AI journey. If you are one of them and looking for a way to counterbalance these cons, check out the certification programs provided by INSAID on their website. If you liked this story, I recommend you to go with the Global Certificate in Data Science & AI because this one will cover your foundations, machine learning algorithms, and deep neural networks (basic to advance).
Follow us for more upcoming future articles related to Data Science, Machine Learning, and Artificial Intelligence.
Also, Do give us a Clap👏 if you find this article useful as your encouragement catalyzes inspiration for and helps to create more cool stuff like this.