SilverStripe DynamoDB integration.

Installs: 248 246

Dependents: 7

Suggesters: 0

Security: 0

Stars: 4

Watchers: 11

Forks: 14

Open Issues: 2


5.0.1 2023-09-18 03:20 UTC



This module enables storing SilverStripe sessions in DynamoDB.


  • SilverStripe 5.0+
  • PHP 8.1+


Add these custom repositories to your composer.json

composer require silverstripe/dynamodb

Sessions with DynamoDB

If you wish to store sessions in DynamoDB, set the required environment variables in .env:

# The name of the DynamoDB table to store sessions in

# The region that the DynamoDB table will live in (in this example here it uses Sydney)

Once these are in place, this module will configure DynamoDB and register that as the session handler.

Before you can actually use this, you need to create a table in which to store the sessions. Follow the instructions in the AWS SDK for PHP documentation.

IMPORTANT: You need to set up a TTL attribute for garbage collection in your table. The module does not provide automated garbage collection abilities.

Using DynamoDB outside of AWS

Sometimes you'll want to test that DynamoDB sessions work on your local development environment. You can make that happen by defining AWS_ACCESS_KEY and AWS_SECRET_KEY. Please don't define these constants in the environment file in EC2 instances, as credentials are automatically handled by the IAM role inside of AWS.

# The AWS access key and secret. This is optional if you've configured an instance with an IAM role
# Note that AWS_ACCESS_KEY can only contain alphanumeric characters 

Local Testing

You can simulate DynamoDB locally for easier development through DynamoDB Local.

Set environment constants. Note that actual access keys and regions are ignored, they just need to be defined.


Download DynamoDB Local and start it - it'll be available under http://localhost:8000.

Now use the AWS CLI Tools to interact with your local DynamoDB.

Configure user (optional):

You can configure a user to use with the AWS CLI tools. Use this if you are having issues with the environment variables being picked up.

aws configure set aws_access_key_id myaccesskey
aws configure set aws_secret_access_key myaccesskey
aws configure set default.region ap-southeast-2

Create table:

aws dynamodb create-table --table-name mysession --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --endpoint-url http://localhost:8000

List tables:

aws dynamodb list-tables --endpoint-url http://localhost:8000

List all sessions:

aws dynamodb scan --table-name mysession --endpoint-url http://localhost:8000

Delete all sessions (use create table to reset afterwards):

aws dynamodb delete-table --table-name mysession --endpoint-url http://localhost:8000


Do you want to contribute? Great, please see the guide.


This module is released under the BSD 3-Clause License, see