- Hosting: AWS EC2
- Webserver: Apache
- Language: Python
- Framework: Flask
- Create an EC2 instance
- New security group
- New keypair
Locally (on your laptop)
After you download the key (pem file) from AWS, save it to the .ssh directory in your home directory.
mv got.pem ~/.ssh
Change the permissions on that file in order for ssh to work.
chmod 400 got.pem
Access the remote computer. ssh = Secure shell.
ssh -i ~/.ssh/got.pem ec2-user@ec2-54-164-88-224.compute-1.amazonaws.com
This video is pretty good: https://www.youtube.com/watch?v=M2Wc8JIS-p8 However: I’d recommend keeping all your keys in ~/.ssh/
$ sudo yum update
$ sudo yum install -y httpd24
$ sudo yum install mod24_wsgi-python27.x86_64
$ sudo pip install flask
Run the web server
$ sudo service httpd restart
Reference
Flask in AWS (one way):
chmod 711 . on home directory
mkdir ~/flaskapp
sudo ln -sT ~/flaskapp /var/www/html/flaskapp
$ cd ~/flaskapp
$ echo "Hello World" > index.html
# we can sanity test at this point
sudo vi /etc/httpd/conf/httpd.conf
WSGIDaemonProcess flaskapp threads=5
WSGIScriptAlias / /var/www/html/flaskapp/flaskapp.wsgi
<Directory flaskapp>
WSGIProcessGroup flaskapp
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
$ sudo service httpd restart
$ sudo yum install python27-pip
$ sudo yum install python27-devel
$ sudo yum install mysql27-devel
$ sudo yum install MySQL-python27
# hits
$ sudo tail -f /var/log/httpd/access_log
# errors
$ sudo tail -f /var/log/httpd/error_log