So, what does all of the above have to do with Django? We are happy to announce that the latest version of BitNami Django Stack ships the most popular Python interface to Amazon Web Services: the boto project. Boto is an integrated interface to current and future infrastructure services offered by Amazon, including S3, EC2, SQS, ELB, SNS among others.
Please see below for a quick intro on how to use boto to launch a BitNami Django Stack instance in the EC2 Cloud:
- First, create a text file (aws-credentials.txt) that includes your AWS credentials :
- Go to your BitNami Django Stack installation and open the "use_djangostack" console and set the AWS_AWS_CREDENTIAL_FILE environment variable.
On OS X or Linux: $ export AWS_AWS_CREDENTIAL_FILE=/path/to/aws-credentials.txt
- Open a Python terminal and create a the connection
Python 2.6.5 (r265:79063, Nov 16 2011, 09:41:19) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information.
>>> from boto.ec2.connection import EC2Connection
>>> connection = EC2Connection()
- Check that your aws credentials are correct if you see the following error:
- No launch the BitNami DjangoStack AMI using boto:
>>> image = images >>> image.location u'979382823631/bitnami-djangostack-1.3.1-1-linux-ubuntu-10.04-ebs'
>>> reservation = image.run()
- Now it is starting the instance, you can check the state
>>> instance = reservation.instances
>>> instance.state u'pending'
>>> instance.update() u'running'
- Once instance is running, you will know the public domain name and you can check that it is working from your web browser.
- As we have started an EBS volume, you can select to stop it or remove it once you are done with it.
>>> instance.update() u'stopping'
>>> instance.update() u'stopped'
>>> instance.update() u'terminated'