lloydshanks / thirty-min-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thirty Minute Python Web App on Amazon

Build and Deploy a Python Web App to Amazon in 30 minutes

Setup

Install Pip, Fabric, Flask and Boto

$ curl -O http://pypi.python.org/packages/source/p/pip/pip-1.0.tar.gz
$ tar xvfz pip-1.0.tar.gz
$ cd pip-1.0 && python setup.py install

$ pip install fabric flask boto

Create an Amazon Web Services Account

Create a Local Settings File that Stores Amazon settings

# Sample local_settings.py

# Amazon Values
aws_key = 'DFGTAKIAJ4HFA'
aws_secret = 'ASklKUYljkja97Kjk+adsasd/adsdssdsds'
aws_key_path = '/home/foobar/.ssh/aws_keypair.pem'
aws_key_pair = 'my_keypair_name'
aws_security_group = 'default'

# Github Value
github_user = 'my_github_name'

Deploy the Code to Amazon Server

NOTE: Whenever you deploy instances to Amazon you will be charged the hourly rate per instance type. The below command will start the clock on charges until you Stop or Terminate an instance.

$ fab deploy_web

Customize

Edit variables defined in settings.py AWS global variable to change Amazon instance size and Machine Images

'defaults' : {
        'image_id' : 'ami-aecd60c7',       # Amazon Linux 64-bit
        'instance_type' : 't1.micro',      # Micro Instance

About