This is my blogpost that shows details of AWS Deployment of Personal Flash Website.

Here are the steps from git clone to build and run Flask locally on AWS after connecting to AWS EC2

cd /home/ubuntu/navan-flask
git clone https://github.com/NavanYatavelli/BeeFlask.git

Edit docker-compose.yml file

version: '3'
services:
        web:
                image: flask_port_v1
                build: .
                ports:
                        - "8087:8080"

Run and check if docker-compose process is running

// Run docker-compose
sudo docker-compose up -d

//Check Docker process running (optional)
sudo docker-compose ps

Acesss locally

curl localhost:8087

Acesss locally jpg

Configure nginx to redirect requests. Nginx listens for the Web Application request and directs it to the Web Application service. Internet requests for 8081 port maps to 8087 port on localhost

18.216.138.52:8081 –> localhose:8087

// contents of file -- /etc/nginx/sites-available/navan-flask

server {
        listen 8081;
        listen [::]:8081;
        server_name 18.216.138.52;

        location / {
                proxy_pass http://localhost:8087;
                add_header "Access-Control-Allow-Origin" *;
        }
}

Accesss Flask Website - Browser

Personal Flask Website personal-flask-website jpg

Make change in github.com/../BeeFlask to this file /BeeFlask/templates/index.html

personal-flask-website jpg

Get latest from Github to AWS, rebuild and relaunch docker process

cd /home/ubuntu/navan-flask
git pull

//Check Docker process running (optional)
sudo docker-compose ps

// Kill the docker process
sudo docker-compose kill

//Rebuid Docker
sudo docker-compose build --no-cache

//Restart Docker process
sudo docker-compose up -d

Acesss locally

curl localhost:8087

Acesss locally jpg

Accesss Flask Website - Browser, shows updated

personal-flask-website jpg