|
| 1 | +--- |
| 2 | +title: DynamoDB |
| 3 | +sidebar_position: 4 |
| 4 | +--- |
| 5 | + |
| 6 | +import Tabs from '@theme/Tabs'; |
| 7 | +import TabItem from '@theme/TabItem'; |
| 8 | + |
| 9 | +# DynamoDB Audit Store |
| 10 | + |
| 11 | +This page explains how to configure **Amazon DynamoDB** as Flamingock's audit store in the **Community Edition**. |
| 12 | +The audit store is where Flamingock records execution history and ensures safe coordination across distributed deployments. |
| 13 | + |
| 14 | +> For a conceptual explanation of the audit store vs target systems, see [Audit store vs target system](../overview/audit-store-vs-target-system.md). |
| 15 | +
|
| 16 | +--- |
| 17 | + |
| 18 | +## Minimum setup |
| 19 | + |
| 20 | +To use DynamoDB as your audit store you need to provide: |
| 21 | +- A **DynamoDbClient** |
| 22 | + |
| 23 | +That's all. Flamingock will take care of tables, indexes, and capacity defaults. |
| 24 | + |
| 25 | +Example: |
| 26 | + |
| 27 | +```java |
| 28 | +import software.amazon.awssdk.regions.Region; |
| 29 | +import software.amazon.awssdk.services.dynamodb.DynamoDbClient; |
| 30 | +import io.flamingock.core.Flamingock; |
| 31 | +import io.flamingock.community.audit.DynamoSyncAuditStore; |
| 32 | + |
| 33 | +public class App { |
| 34 | + public static void main(String[] args) { |
| 35 | + DynamoDbClient client = DynamoDbClient.builder() |
| 36 | + .region(Region.US_EAST_1) |
| 37 | + .build(); |
| 38 | + |
| 39 | + Flamingock.builder() |
| 40 | + .setAuditStore(new DynamoSyncAuditStore() |
| 41 | + .withClient(client)) |
| 42 | + .build() |
| 43 | + .run(); |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Supported versions |
| 51 | + |
| 52 | +| AWS SDK | DynamoDB | Support level | |
| 53 | +|--------------------------------|----------------|-----------------| |
| 54 | +| `dynamodb` 2.25.29+ | All versions | Full support | |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Dependencies |
| 59 | + |
| 60 | +<Tabs groupId="build_tool"> |
| 61 | + |
| 62 | +<TabItem value="gradle" label="Gradle"> |
| 63 | + |
| 64 | +```kotlin |
| 65 | +implementation(platform("io.flamingock:flamingock-community-bom:$flamingockVersion")) |
| 66 | +implementation("io.flamingock:flamingock-community") |
| 67 | + |
| 68 | +// AWS SDK (if not already present) |
| 69 | +implementation("software.amazon.awssdk:dynamodb:2.28.0") |
| 70 | +implementation("software.amazon.awssdk:dynamodb-enhanced:2.28.0") |
| 71 | +``` |
| 72 | + |
| 73 | +</TabItem> |
| 74 | + |
| 75 | +<TabItem value="maven" label="Maven"> |
| 76 | + |
| 77 | +```xml |
| 78 | +<dependencyManagement> |
| 79 | + <dependencies> |
| 80 | + <dependency> |
| 81 | + <groupId>io.flamingock</groupId> |
| 82 | + <artifactId>flamingock-community-bom</artifactId> |
| 83 | + <version>${flamingock.version}</version> |
| 84 | + <type>pom</type> |
| 85 | + <scope>import</scope> |
| 86 | + </dependency> |
| 87 | + </dependencies> |
| 88 | +</dependencyManagement> |
| 89 | + |
| 90 | +<dependency> |
| 91 | + <groupId>io.flamingock</groupId> |
| 92 | + <artifactId>flamingock-community</artifactId> |
| 93 | +</dependency> |
| 94 | + |
| 95 | +<!-- AWS SDK (if not already present) --> |
| 96 | +<dependency> |
| 97 | + <groupId>software.amazon.awssdk</groupId> |
| 98 | + <artifactId>dynamodb</artifactId> |
| 99 | + <version>2.28.0</version> |
| 100 | +</dependency> |
| 101 | +<dependency> |
| 102 | + <groupId>software.amazon.awssdk</groupId> |
| 103 | + <artifactId>dynamodb-enhanced</artifactId> |
| 104 | + <version>2.28.0</version> |
| 105 | +</dependency> |
| 106 | +``` |
| 107 | + |
| 108 | +</TabItem> |
| 109 | + |
| 110 | +</Tabs> |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Configuration options |
| 115 | + |
| 116 | +DynamoDB audit store works out of the box with production-ready defaults. |
| 117 | +Optional properties let you tune behavior if needed: |
| 118 | + |
| 119 | +| Property | Default | Description | |
| 120 | +|---------------------------------|------------------------|------------------------------------------------------------------| |
| 121 | +| `dynamodb.autoCreate` | `true` | Auto-create tables if they don't exist. | |
| 122 | +| `dynamodb.readCapacityUnits` | `5` | Read capacity units (PROVISIONED mode only). | |
| 123 | +| `dynamodb.writeCapacityUnits` | `5` | Write capacity units (PROVISIONED mode only). | |
| 124 | +| `dynamodb.auditRepositoryName` | `flamingockAuditLogs` | Table name for audit entries. | |
| 125 | +| `dynamodb.lockRepositoryName` | `flamingockLocks` | Table name for distributed locks. | |
| 126 | + |
| 127 | +Example overriding defaults: |
| 128 | + |
| 129 | +```java |
| 130 | +Flamingock.builder() |
| 131 | + .setAuditStore(new DynamoSyncAuditStore() |
| 132 | + .withClient(client) |
| 133 | + .withProperty("dynamodb.readCapacityUnits", 10) |
| 134 | + .withProperty("dynamodb.writeCapacityUnits", 10)) |
| 135 | + .build() |
| 136 | + .run(); |
| 137 | +``` |
| 138 | + |
| 139 | +⚠️ **Warning**: Adjust capacity units based on your workload. Under-provisioning may cause throttling. |
| 140 | +Consider using **ON_DEMAND** billing mode for unpredictable workloads. |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## Next steps |
| 145 | + |
| 146 | +- Learn about [Target systems](../flamingock-library-config/target-system-configuration.md) |
| 147 | +- 👉 See a [full example project](https://github.com/flamingock/flamingock-examples/tree/master/dynamodb) |
0 commit comments