User guide

Table Of Contents
Note
If you decide not to create the table beforehand, the session state provider will create the table
for you during its initialization. See the web.config options below for a list of attributes that act
as configuration parameters for the session-state table. If the provider creates the table, it will
use these parameters.
Configure the Session State Provider
To configure an ASP.NET application to use DynamoDB as the session state server
1. Add references to both AWSSDK.dll and AWS.SessionProvider.dll to your Visual Studio
ASP.NET project. These assemblies are available by installing the AWS SDK for .NET (p. 4) or
you can install them using NuGet (p. 29).
In earlier versions of the SDK, the functionality for the session state provider was contained in
AWS.Extension.dll.To improve developer usability the functionality was moved to AWS.Session-
Provider.dll. For more information, see the blog post AWS.Extension Renaming.
2. Edit your application's Web.config file: in the system.web element, replace the existing session-
State element with the following XML fragment:
<sessionState
timeout="20"
mode="Custom"
customProvider="DynamoDBSessionStoreProvider">
<providers>
<add name="DynamoDBSessionStoreProvider"
type="Amazon.SessionProvider.DynamoDBSessionStateStore"
AWSProfileName="profile_name"
Region="us-west-2"
/>
</providers>
</sessionState>
The profile represents the AWS credentials that are used to communicate with DynamoDB to store
and retrieve the session state. If you are using the AWS SDK for .NET and are specifying a profile
in the appSettings section of your application's Web.config file, you do not need to specify a
profile in the providers section; the AWS .NET client code will discover it at run time. For more
information, see Configuring Your AWS SDK for .NET Application (p. 8).
If the web server is running on an Amazon EC2 instance that is configured to use IAM roles for EC2
instances, then you do not need to specify any credentials in the web.config file. In this case, the
AWS .NET client will use the IAM roles credentials. For more information, see Tutorial: Using an IAM
Role (p. 47) and Security Considerations (p. 35).
Web.config Options
You can use the following configuration attributes in the providers section of your web.config file:
AWSAccessKey
Access key ID to use.This can be set either in the providers section or in the appSettings section.
We recommend not using this setting. Instead, specify credentials by using AWSProfileName to
specify a profile.
Version v2.0.0
34
AWS SDK for .NET Developer Guide
Configure the Session State Provider