User guide
Downloading the Session Manager
You can download the session manager from the aws/aws-dynamodb-session-tomcat project on GitHub.
That project also hosts the session manager source code if you want to contribute to the project by sending
us pull requests or opening issues.
Configure the Session-State Provider
To use the DynamoDB session-state provider, you need to 1) configure the Tomcat server to use the
provider, and 2) set the security credentials of the provider so that it can access AWS.
Configuring a Tomcat Server to Use DynamoDB as the Session-State Server
Copy AmazonDynamoDBSessionManagerForTomcat-1.x.x.jar to the lib directory of your Tomcat
installation. AmazonDynamoDBSessionManagerForTomcat-1.x.x.jar is a complete, standalone jar,
containing all the code and dependencies to run the DynamoDB Tomcat Session Manager.
Edit your server's context.xml file to specify
com.amazonaws.services.dynamodb.sessionmanager.DynamoDBSessionManager as your session
manager.
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager className="com.amazonaws.services.dynamodb.sessionmanager.Dy
namoDBSessionManager"
createIfNotExist="true" />
</Context>
Configuring Your AWS Security Credentials
You can specify AWS security credentials for the session manager in multiple ways, and they are loaded
in the following order of precedence:
1. The AwsAccessKey and AwsSecretKey attributes of the Manager element explicitly provide
credentials.
2. The AwsCredentialsFile attribute on the Manager element specifies a properties file from which
to load credentials.
If no credentials are specified through the Manager element, DefaultAWSCredentialsProviderChain
will keep searching for credentials in the following order:
1. Environment Variables – AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
2. Java System Properties – aws.accessKeyId and aws.secretKey
3. Instance profile credentials delivered through the Amazon EC2 instance metadata service (IMDS).
Configuring with AWS Elastic Beanstalk
If you're using the session manager in AWS Elastic Beanstalk, you need to ensure your project has a
.ebextensions directory at the top level of your output artifact structure. In that directory, place the
following files:
• The AmazonDynamoDBSessionManagerForTomcat-1.x.x.jar file.
• A context.xml file as described previously to configure the session manager.
Version v1.0.0
21
AWS SDK for Java Developer Guide
Manage Tomcat Session State with DynamoDB