Moving to AWS. The journey.

I had started learning Flask and felt that a good way to practice it would be redesigning my site with it.

It was pretty easy and the documentation was really good. As a Pythonista, I loved it. The only problem I had was that my hosting provider was GoDaddy(a blunder that I committed in my early days) and that meant hosting a Flask app was impossible. Luckily for me, my hosting plan with GoDaddy was going to expire pretty soon and I was looking for other hosting providers.

I had been given a 100 dollar credit on Amazon Web Services in a hackathon and I decided to give it a try. I host some of my applications on Heroku and I thought migrating completely to AWS might make it a lot simpler and give me more control. Plus, having to setup everything from scratch made it interesting and I was all set for the task.

The initial setup on AWS like installing Apache, Flask were simple.

I just had to run a few commands like

sudo apt-get install apache2 libapache2-mod-wsgi

wget https://bootstrap.pypa.io/get-pip.py; python get-pip.py

pip install flask

pip install flask-flatpages

The next step was to get the Flask app up and running with Apache. This is where I ran into some troubles as most tutorials and documentations that I could find online were leading to 500 or 404 errors. I played around for several hours and finally managed to get it to work. These were the steps I followed:

sudo su

cd /var/www

git clone urlto://git.repo (say flaskapp)

cd flaskapp

After this, create a name.wsgi file where name is the name of the file containing the app = Flask(__name__) line.