# 1 Tier App Deployment

In this guide, we will try to deploy a 1 tier app.

Prerequisites  

1. aws account
    
2. dockerhub
    
3. github
    

Step 1:

vim app.py

```plaintext
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)  # Runs on port 5000
```

jkl

vim requirements.txt

```plaintext
flask==2.3.2
```

jkl

### **1\. Install Python & Dependencies**

```plaintext
# Install Python 3 and pip
sudo apt update && sudo apt install -y python3 python3-pip

# Verify installation
python3 --version  # Should show Python 3.x
pip3 --version

# Install Flask (since your app requires it)
pip3 install flask

# If you have requirements.txt:
pip3 install -r requirements.txt
```

kl

### **2\. Run Your Flask App**

```plaintext
# Make sure you're in the right directory
cd /home/ubuntu

# Run the app (Flask defaults to port 5000)
python3 app.py
```

jl

jk

### Dockerize:

docker build -t my-flask-app: v1 .

docker build -t my-flask-app: v2 .

docker run -it -p 5000: 5000 my-flask-app:v2

Remove 2 images:

docker rmi -f 20eb4b2aff1d aba0d6b39753

docker images
