Skip to content

MdShafiurRahman0/aws-ec2-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Providing an EC2 instance with Python

Running locally

  1. Set up venv
# Install 
apt install python3.10-venv

# create
python3 -m venv .venv

# activate (Linux way)
. .venv/bin/activate

# turn off
deactivate
  1. Install dependencies

    pip install -r requirements.txt

  2. Run

    uvicorn app.main:app --reload

Running with Docker

// Build
docker build -t python-fast-api .

// Run
docker run -p 8001:8000 python-fast-api

Running with Docker Compose

docker-compose up -- build

Running with Shell script

./run.sh

Running into the EC2 isntance

sudo apt-get update
sudo apt-get upgrade
sudo apt install python3-pip
pip install -r requirements.txt
sudo apt install uvicorn
uvicorn app.main:app

uvicorn app.main:app --host 0.0.0.0 --port 8000

Testing

http://localhost:8001/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors