Skip to content
DynamoDB integration for the LaunchDarkly .NET SDK
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
dotnet-base
dotnet-server-sdk-shared-tests
src/LaunchDarkly.ServerSdk.DynamoDB
test/LaunchDarkly.ServerSdk.DynamoDB.Tests
.gitignore
CHANGELOG.md
LICENSE
LaunchDarkly.ServerSdk.DynamoDB.sln
README.md

README.md

LaunchDarkly Server-Side SDK for .NET - DynamoDB integration

CircleCI

This library provides a DynamoDB-backed persistence mechanism (feature store) for the LaunchDarkly .NET SDK, replacing the default in-memory feature store. It uses the AWS SDK for .NET.

The minimum version of the LaunchDarkly .NET SDK for use with this library is 5.6.0.

For more information, see also: Using a persistent feature store.

.NET platform compatibility

This version of the library is compatible with .NET Framework version 4.5 and above, .NET Standard 1.6, and .NET Standard 2.0.

Quick setup

  1. In DynamoDB, create a table which has the following schema: a partition key called "namespace" and a sort key called "key", both with a string type. The LaunchDarkly library does not create the table automatically, because it has no way of knowing what additional properties (such as permissions and throughput) you would want it to have.

  2. Use NuGet to add this package to your project:

     Install-Package LaunchDarkly.ServerSdk.DynamoDB
    
  3. Import the package (note that the namespace is different from the package name):

     using LaunchDarkly.Client.DynamoDB;
    
  4. When configuring your LDClient, add the DynamoDB feature store:

     Configuration ldConfig = Configuration.Default("YOUR_SDK_KEY")
         .WithFeatureStoreFactory(DynamoDBComponents.DynamoDBFeatureStore("my-table-name"));
     LdClient ldClient = new LdClient(ldConfig);
    
  5. Optionally, you can change the DynamoDB configuration by calling methods on the builder returned by DynamoDBFeatureStore():

     Configuration ldConfig = Configuration.Default("YOUR_SDK_KEY")
         .WithFeatureStoreFactory(
             DynamoDBComponents.DynamoDBFeatureStore("my-table-name")
                 .WithCredentials(new BasicAWSCredentials("my-key", "my-secret"))
         );
     LdClient ldClient = new LdClient(ldConfig);
    
  6. If you are running a LaunchDarkly Relay Proxy instance, you can use it in daemon mode, so that the SDK retrieves flag data only from Redis and does not communicate directly with LaunchDarkly. This is controlled by the SDK's UseLdd option:

     Configuration ldConfig = Configuration.Default("YOUR_SDK_KEY")
         .WithFeatureStoreFactory(DynamoDBComponents.DynamoDBFeatureStore("my-table-name"))
         .WithUseLdd(true);
     LdClient ldClient = new LdClient(ldConfig);
    

Caching behavior

To reduce traffic to DynamoDB, there is an optional in-memory cache that retains the last known data for a configurable amount of time. This is on by default; to turn it off (and guarantee that the latest feature flag data will always be retrieved from DynamoDB for every flag evaluation), configure the builder as follows:

            DynamoDBComponents.DynamoDBFeatureStore("my-table-name")
                .WithCaching(FeatureStoreCacheConfig.Disabled)

Or, to cache for longer than the default of 30 seconds:

            DynamoDBComponents.DynamoDBFeatureStore("my-table-name")
                .WithCaching(FeatureStoreCacheConfig.Enabled.WithTtlSeconds(60))

Signing

The published version of this assembly is strong-named. Building the code locally in the default Debug configuration does not use strong-naming and does not require a key file.

Development notes

This project imports the dotnet-base and dotnet-server-sdk-shared-tests repositories as subtrees. See the README.md file in each of those directories for more information.

To run unit tests, you must have a local DynamoDB server. More information here.

Releases are done using the release script in dotnet-base. Since the published package includes a .NET Framework 4.5 build, the release must be done from Windows.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out our documentation for a complete list.
  • Explore LaunchDarkly
You can’t perform that action at this time.