Skip to content
Related Articles

Related Articles

How to Install Python3 on AWS EC2?

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Expert
  • Last Updated : 31 Jan, 2022

AWS or Amazon web services is a cloud service platform that provides on-demand computational services, databases, storage space, and many more services. EC2 or Elastic Compute Cloud is a scalable computing service launched on the AWS cloud platform. In simpler words, EC2 is nothing but a virtual computer on which we can perform all our tasks and we have the authority to configure, launch or even dissipate this virtual computer.

In this article, we will learn how to install Python on AWS EC2.

Prerequisite:

  1. AWS account.
  2. EC2 Instance.
  3. User with privileges to create Instance.

Installing Python on AWS EC2 :

Follow the below steps to install Python on AWS EC2:

Step 1: Create an AWS Elastic Cloud Compute Instance.

Step 2: Start the EC2 instance that you have created in Step 1.

Step 3: Connect to your EC2 Instance by clicking on Connect Button. 

Step 4: A prompt will pop up after connecting.

Step 5: Check if Python is already installed or not on our AWS EC2.

python --version

Step 6: At first update, Ubuntu packages by using the following command.

sudo apt update

Step 7: If Python3 is not installed on your AWS EC2, then install Python3 using the following command.

sudo apt-get install python3.7

Step 8: Wait for the process to end.

Step 9: We have successfully installed Python3 on AWS EC2, to check if Python3 is successfully installed or not, verify using the following command.

python3 --version

In this way, we can Install Python3 on our EC2 instance using EC2 Instance Connect.

Let’s try to create a Python program on nano and then execute that python program on our EC2 instance:


Python3




#example using python3 
#gfg.py
print("Geeks for Geeks is the best website for a programmer")

Output

Geeks for Geeks is the best website for a programmer

Output

Note: If you also use a free tier account, make sure you delete all the resources you have used before logging out. 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!