Getting started with Django on Amazon Web Services [closed]
Asked Answered
F

3

23

I'm starting to migrate a few applications to Amazon Web Services. My applications are Python/Django apps, running over MySQL.

I plan on using EC2 and EBS for starters.

I'm looking for a few things:

  1. A good step-by-step tutorial explaining how to deploy Django on AWS. I've looked around, but most tutorials are from 2 years ago, so I'm worried they're outdated.

  2. I'm trying to understand, with which AMI should I start? I know there's a BitNami AMI that comes preconfigured with Django goodiness, but I've seen a lot of other sources say you should start with a basic (clean) linux box and install everything yourself. Why?

  3. Are there any other important things I should be thinking about? I have very little sysadmining experience (the apps are currently on WebFaction), so I'm not sure what I should be thinking about.

A few extra points:

  • I plan on running several applications on the same EC2 instance, I assume that's possible?
  • I'm using virtualenv to separate between the various apps right now, I assume I can continue doing the same on the EC2 instance?

Thanks!

Fabe answered 20/12, 2010 at 10:33 Comment(7)
An AMI is just a form ox Xen virtual machine, you get a full linux OS there mostly, and setting up anything on that is similar to setting it up on any linux server. Starting with your own is sensible as 1) you know how it's setup, 2) you know there aren't any backdoors or rootkits put in by the preconfigured AMI author.Freedafreedman
Also, to note, administration side tends to move a lot slower than other computing areas, 2 years really is a short amount of time in web administration (not so much in API stability and programming).Freedafreedman
Finally this is probably better on serverfault than stackoverflow.Freedafreedman
@ewanm89: Thanks. I wondered whether I should ask on SF instead of SO, wasn't sure. In any case, why not post your comments as an answer?Fabe
I probably would have if it was serverfault...Freedafreedman
plus it's only a partial answerFreedafreedman
I asked a slightly different (but related) question on SF - serverfault.com/questions/214413/….Fabe
H
9

There is nothing "special" with EC2 here. It just provides bare (or generally preconfigured from custom AMI) system instance - you have access to whole virtualized system, so you can safely break things on your own. Think about it as a specific VPS.

You have to prepare deployment by yourself, which is not so difficult - just follow the documentation. I'd advice to run with basic linux distro and add needed stuff than to rely on some preconfigured image. As for you questions:

  1. You need to do two things: setup your instance (accounts, needed software, other custom setup, so some linux administration guide should be handy) and prepare django app deployment (deploy python code, hook up to web server). For the latter, general deployment instructions for django can be applied here ( http://docs.djangoproject.com/en/dev/howto/deployment/ ).

  2. Start with AMI with your favorite linux distro, and then add necessary software from it's repository.

  3. Mount and use EBS as soon as possible for all your data. When rebooted, EC2 instance will wipe out all it's data, so be prepared for this. Do system snapshots to AMI to have quick recovery on failure.

Yes, you can deploy several applications on one instance, but mind that EC2 instance is virtualized (with quite high "virtualization tax" imo, especially for smaller instances), so you might run into general performance problems. Assume that you'd need migrate to bigger instance/multiple instances after some time.

Virtualenv should be your default deployment tool. Yes, you can use it here too.

Haily answered 20/12, 2010 at 12:8 Comment(1)
worth noting, the highest instances are the only VM running on the machine (apart from Xen's dom0, hypervisor) and so, don't have much virtualization tax at all.Freedafreedman
M
1

You can follow the official documentation of setting up Amazon ec2 instance: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-instance_linux.html

You should start with an AMI that you are familiar with. For example, if you use Ubuntu, you can just use one of the Ubuntu AMI in the recommended page. I didn't use the BitNami server and my Django site is deployed smoothly.

If you are using Apache server, just follow the instructions on the official Django doc: https://docs.djangoproject.com/en/1.5/howto/deployment/wsgi/modwsgi/

I tried quite a few blogs but as you said, they are outdated. Just use the official docs and it will save you a lot of time.

Malignity answered 30/10, 2013 at 19:4 Comment(0)
P
0

This repo is meant to address exactly this issue - provide a reference implementation for a basic django project that can be deployed onto AWS ElasticBeanstalk.

https://github.com/pushkarparanjpe/django-awsome

It has:

  • Static assets
  • DB back-end
  • django contrib Admin

Just configure your EBS env, clone the repo and deploy!

Preclinical answered 4/3, 2016 at 8:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.