How To Deploy Python Application In AWS?
Last Updated :
04 Mar, 2024
In this article, we will explore how one as a Python developer can deploy the application by harnessing the capabilities of AWS. AWS, a leading cloud computing platform, offers a wide range of services to help developers build, deploy, and manage applications at scale EC2. It provides scalable computing power in the cloud, allowing developers to scale quickly or down depending on application demand. We will use the EC2(Elastic Compute Cloud) service provided by AWS to make our server and run our application onto this server.
Why To Deploy Python Applications On AWS?
- Scalability: AWS provides a scalable infrastructure, allowing your Python application to easily handle multiple tasks.
- Elastic Beanstalk: AWS Elastic Beanstalk is a Platform-as-a-Service (PaaS) offering that simplifies the deployment and management of Python applications.
- Reliability and Availability: AWS offers global connectivity across data centers, ensuring its high level of reliability for your Python application.
Step-By-Step Guide To Deploy Python Applications In AWS
Step 1: Log in with AWS Account with your credentials and Navigate to AWS Management Console.
Step 2: After signing in you will land on the AWS Management Console page and search for EC2 as shown below.

Step 3: This will land you on Amazon EC2 dashboard from there select instances from left menu.

Step 4: From top right, select Launch instances this will allow us to make EC2 instance (server). This server will contain all the necessary files which you need to deploy your application.

Step 5: Give name to your server and select OS image (AMI) as Ubuntu. You can also select another images. This OS image will give you the ability to interact with server.

Step 6: Select default key-pair name and check box of http/https. This will allow us to test your application on Http/https protocol.

Step 7: Launch instance from bottom right corner. After that you will get status as success.

Step 8: Goto your instances and check box according to your instance name. And from top menu select connect. This will connect your ubuntu with your instance.

Step 9: Keep setting as it is and connect. This will connect your os with server.

Step 10: This will open ubuntu terminal. Clone your project github repository into server. Provide your python application containing github url.
git clone <your_github_repository_url>

Step 11: Move to downloaded git repo directory using cd command.
cd <folder_path>

Step 12: Now update present packages in server using following command.
sudo apt update

Step 13: Install pip using python3 in server to install your packages using following command and press yes for any prompt.
sudo apt install python3-pip

Step 14: Now install all the dependencies into your server using requirements.txt. If not present in your project create it.
pip3 install -r requirements.txt

Step 15: Now run your application. Running your applications depends on what tech stack is used to make the application. In my case its FastAPI so I'll just directly run main.py.
Also copy public IP from below and port number (for me 8000) . At this IP your app will be hosted.

Step 16: Open new tab and enter your IP with port number separated with colon (:).

Conclusion
In this article, we deployed python application on AWS using EC2 service provided by AWS. We used github repo and clone our code in server, also installed required packages and then run the application from which your application will be live in IP provided by AWS.
Similar Reads
How To Deploy Python Application In Kubernetes ?
In today's IT world we are moving from the monolithic to microservice architecture to make our applications highly available and scalable to bring fault tolerance. In this transformation, containerization i.e., containerizing the application are a fundamental aspect of this micro services. In this a
6 min read
How To Deploy Node Js Application In AWS Lightsail ?
Lightsail can be defined as a simple, easy-to-use, and user-friendly service offered by Amazon Web Services (AWS). The main goal of Lightsail is to provide an easy way for individuals, startups, and small businesses to launch and manage virtual private servers (VPS) and other cloud services without
6 min read
How to Deploy Django Application in AWS Lambda?
Pre-requisite: AWS , Python Django is a Python web framework that makes it easy to build web applications quickly and securely. It has a large and helpful community that provides support and contributes to its development. AWS Lambda is a serverless computing platform that runs your code in Docker c
7 min read
How to Deploy Django Application in AWS EC2?
In this article, we will study how we can deploy our existing Django web application to Windows Server in AWS EC2. We will also see how to use the public IP of the EC2 instance to access the Django application. For this article, you should know about setting up EC2 in AWS. We will see how to deploy
3 min read
Deploying Python Applications with Gunicorn
Gunicorn `Green Unicorn` is a pure Python HTTP server for WSGI applications, originally published by Benoit Chesneau on 20th February 2010. Itâs a WSGI (Web Server Gateway Interface) HTTP server, a calling convention used for a group of web servers that forward requests to web applications or framew
6 min read
How to Deploy a Web Application on GCP?
Google Cloud Platform is one of the cloud service providers that provide various cloud services for a seamless experience. It provides various services like storage, networks, development tools, Analytics tools, infrastructure, and many more. Benefits Of Deploying Web Applications on Google Cloud Pl
4 min read
Deploy a React Application with AWS
AWS is a subsidiary of Amazon & offers a broad range of cloud computing services, which means services using their infrastructure which is hosted on various data centers all over the world which we can rent to run our own solutions. In this article, we will learn how to deploy a React applicatio
4 min read
How to Build Python Application Using Jenkins ?
Jenkins is one of the most popular automation tools used worldwide for Continuous Integration and Continuous Delivery. It is a free and open-source automation server that enables developers to build, integrate and test the code automatically as soon as it is committed to the source repository. Build
7 min read
Deploying Web Applications On AWS Lightsail
Amazon Web Service offers a service called Lightsail which is used for deploying and managing web applications. It is well suited for small-scale businesses and developers it will scale and manage the application in the cloud. What is Amazon Lightsail?For anyone who needs to develop websites or web
8 min read
How To Host Your React Application In Aws S3 ?
Hosting the react application on the AWS S3 offers the cost effective and scalable solutions for the deploying the static web applications and it can provides the reliable infrastructure for the storing and serving files through the internet. Understanding Of Key TerminologiesReact: It is the JavaSc
4 min read