Useful Links‎ > ‎

Getting Started with BitNami and AWS

Note: as of now, this tutorial will get you to the point of displaying a web page on AWS but will not help you with figuring out how to administer the server, access files on the server, or upload any custom python/django code to AWS. Also, you probably need to engage in full-fledged Django development (a tutorial can be found here) much earlier to put a reasonable website together. This is something you may want to tackle in pieces (and possibly switch to later in the semester) if you find this daunting. 

If you are an experienced system administrator (some *nix experience) and you want a more fully functioned option, you can use a combination of BitNami and Amazon Web Services for this and future assignments. In this case, you will first use BitNami to install the “Django Stack” (found at on your personal machine. If you run into any trouble, the BitNami community is also fairly quick to respond if you run into bugs. The instructions are OS X specific but should translate to Windows without major changes. When signing up for an account with BitNami, you should select the basic (free) account. This will be sufficient for the needs of the class.

BitNami's Django stack can be downloaded from BitNami’s Django Stack page. You want the Installer, not the Virtual Machine or Cloud Server. We recommend that you use BitNami to install the “Django Stack” (found at on your home machine. The installer will take you through several steps. Partway through, it will ask you about installing a database (we recommend MySQL at a minimum, and be sure to provide a secure password for this). Next, you will reach this screen, which will take you to the BitNami website (be sure to get an account):

When installation is finished, it will provide a Django stack application (which is located on OS X in the /Applications subdirectory). It should look something like this:

Displaying a Page Locally

Your next task is to display a web page. You will need to follow BitNami’s Django Stack instructions. This documentation is Django specific and if you do everything described on that web page, at the end you should have created a new Django application that shows a single page. Your goal is to display the default web page for that application on your local machine. When you are done, you should see the following image at

You may need to start up MySQL and Apache first (which you can do on the BitNami app’s “manage servers” tab). If you click “Go To Application” you should see the page above.

Everything we do from here on out will involve changes to files and running of scripts within the BitNami installation directory. You can find this several ways: Click “Open Application Folder” inside the BitNami Django Stack application; or read the location on the default webpage that comes up when you click “Go To Application” (shown above) under the title “Check Your Installation”.

Inside the BND if you visit apache2/htdocs/index.html you will see the html for the page displayed above. Try adding “Hello World” to the top of it and you reload the page (click the “Go To Application” button in the BitNami Django Stack) and you should see the changes appear. Don’t forget to force your browser to reload or the changes may not show.

Creating your first Django project

The next step is to display a page you create locally. To do this, you will need to begin using python, the primary language in this course. In particular, you will need to run a special python script that creates a Django project. It is important that this happens within the BitNami installation you have just created, so we will first open a shell using a special script provided by BitNami. This script can be found in the BitNami installation directory (the BND) described above, and is called “use_djangostack”. If you double click on it, a window should appear in which you can type commands. However, you should double check that you are in the correct location before you do anything further. You need to be in the directory [BND]/apps/django/django_projects, where [BND] refers to the BitNami installation directory, so on my machine this is

To create your Django project, we will follow a tutorial provided by the Django project. First type: startproject byte_1

This will create the following directory structure:

Next, change directories to byte_1 and type:

python runserver

You should see the following output:
Validating models... 
0 errors found
Django version 1.4.8, using settings 'byte_1.settings'
Development server is running at
Quit the server with CONTROL-C.
[22/Oct/2013 16:37:26] "GET / HTTP/1.1" 200 1957

You can put into your browser, and you should see:

Setting up AWS

The next step is to put that same application on the web using AWS. First, create an AWS account. Once you have an AWS account, you will need to sign in to it and create an access key for BitNami. To do so, you will want to go to the Security Credentials screen, which can be accessed through the menu shown below: 

You will need to open the “Access Keys” portion of the page and press the “Create New Access Key” button. This will ask you to download a file called “rootkey.csv”. Be careful not to lose the file — if you loose it, you also loose access to that access key, and you can only download it once. The contents of the file will look something like this:

Those are the “access key” and “secret access key” that BitNami requires for setup purposes. Enter them both into the BitNami site where prompted, as shown below (note that only the stuff after the = sign is used): 

Be sure to press “save” when you are done.
Displaying the default BitNami web page on AWS

Follow BitNami’s directions for getting started with cloud formation to display the same application in the cloud. However, before you get started, please read the points below:
  • Note that in step 3, it says to choose the BitNami Cloud Formation template you would like to use. You can do this on your server management page. We recommend that you use username-byte1 as the stack name (in my case jmankoff-byte1).
  • The default BitNami stack does not include Django. To include it, click on “Development Options” (shown below as it appeared on the BitNami site 10/13) and check the Django box:

  • Although the Amazon charges are listed at \$15.40 per month, if you are new to AWS (within the first year), these should be free, according to BitNami. AWS provides additional specifics for free hosting in their free usage tier documentation
  • As of 10/13 the directions say to click “create stack” but the website actually has a “Build and Launch” button:

You will know you have succeeded when you can see the following webpage:

Setting up the tools for accessing AWS

Once you have set up AWS with the BitNami stack, you will need to connect to it in order to modify the default web page. To do so, the simplest approach is to use BitNami’s Cloud Tools for AWS stack, which can be found among the BitNami stacks as shown below:

Once the stack is installed, you need to do a small amount of configuration.
  • First, you will need to download your Amazon private key and certificate file from Amazon’s security credentials page (click on “X.509 Certificates” and then click “Create New Certificate”). Download both the private key and the certificate when prompted. Second, you will need the information in “rootkey.csv” (mentioned earlier).
  • When you have all of this information, find the directory where bitnami’s AWS tools were installed (mine is /Applications/bitnami-awstools-1.7-3). Within that, you can find a ”config” directory, which contains 4 files.
    • Open aws-config.txt and aws-credentials.txt and modify them to contain the keys found in “rootkey.csv”.
    • Then copy the contents of your private key into ec2.key, and put the contents of your certificate in ec2.crt.
Note: An alternate approach, if you plan to use AWS for a variety of purposes, is to install the command line tools provided by AWS. These are the Amazon EC2 API Tools. When you download the file and unzip it, you will see installation instructions in readme-install.txt. However, a simpler way to install the API is to use a package management system such as Homebrew if you use OS X. You can also find several blog posts discussing the installation of these tools. You need to place your keys in a different location in this place, I used ~jmankoff/.ec2 and then updated my .bashrc to point at these locations This requires setting the following variables. Note: you should only be using this approach if you have some knowledge of unix and shells and so on.

export JAVA_HOME=”$(/usr/libexec/java_home)”
export EC2_PRIVATE_KEY=”$(/bin/ls “$HOME”/.ec2/pk-*.pem | /usr/bin/head -1)”
export EC2_CERT=”$(/bin/ls “$HOME”/.ec2/cert-*.pem | /usr/bin/head -1)”
export EC2_HOME=”/usr/local/Library/LinkedKegs/ec2-api-tools/jars”

Accessing the AWS server via the command line interface

Once you have set up the configuration directory correctly, you will need to use a command line interface to access the AWS server. BitNami helps to simplify this by providing you with a script that will correctly set up all of your environment variables for this task. Open the directory where the aws tools are installed (in my case, “/Applications/bitnami-awstools-1.7-3″) and run (on OS X) aws-shell (you can just double click on it). This script will set up the command line variables and start a command line shell for you (and let you know if there is any problem with your configuration). Once your shell is set up, you can use any of the programs in the subdirectory of bitnami-awstools-1.7-3 called “aws-tools”. Amazon’s Getting Started with AWS tools page is a good starting place. Some things to try first: