A Django session backend using Amazon's DynamoDB
django-dynamodb-sessions has seen some use on small test environments within EC2. While it should be ready for prime time, it hasn’t been heavily battle tested just yet. Other notes:
Before you can use this module, you’ll need to visit your DynamoDB tab in the AWS Management Console. Then:
After your table is created, you’re ready to install the module on your Django app.
Install django-dynamodb-sessions using pip or easy_install:
pip install django-dynamodb-sessions
In your settings.py file, you’ll need something like this:
DYNAMODB_SESSIONS_AWS_ACCESS_KEY_ID = 'YourKeyIDHere' DYNAMODB_SESSIONS_AWS_SECRET_ACCESS_KEY = 'YourSecretHere'
If you’d like to add a caching layer between your application and DynamoDB to reduce queries (like Django’s cached_db backend), set your session backend to:
SESSION_ENGINE = 'dynamodb_sessions.backends.cached_dynamodb'
Otherwise, go straight to DynamoDB:
SESSION_ENGINE = 'dynamodb_sessions.backends.dynamodb'
After that, fire her up and keep an eye on your Amazon Management Console to see if you need to scale your read/write units up or down.
If you encounter any bugs, have questions, or would like to share an idea, hit up our issue tracker.
The following settings may be used in your settings.py:
|The table name to use for session data storage. Defaults to sessions.|
|The hash attribute name on your session table. Defaults to session_key|
|If you’re not using this session backend behind a cache, you may want to force all reads from DynamoDB to be consistent. This may lead to slightly slower queries, but you’ll never miss object creation/edits. Defaults to True.|
|The access key for the AWS account to use for DynamoDB.|
|The secret for the AWS account to use for DynamoDB.|
|The region to use for DynamoDB.|
django-dynamodb-sessions is licensed under the BSD License.