-
Notifications
You must be signed in to change notification settings - Fork 0
Tags and Admin
DynamoDbLite supports resource tagging on tables, matching the DynamoDB tag API. See Tagging for DynamoDB in the AWS docs.
Adds or overwrites tags on a table.
await client.TagResourceAsync(new TagResourceRequest
{
ResourceArn = "arn:aws:dynamodb:local:000000000000:table/Users",
Tags =
[
new Tag { Key = "Environment", Value = "development" },
new Tag { Key = "Team", Value = "backend" }
]
});Removes tags by key.
await client.UntagResourceAsync(new UntagResourceRequest
{
ResourceArn = "arn:aws:dynamodb:local:000000000000:table/Users",
TagKeys = ["Environment"]
});Lists all tags on a table. All tags are returned in a single response.
var response = await client.ListTagsOfResourceAsync(new ListTagsOfResourceRequest
{
ResourceArn = "arn:aws:dynamodb:local:000000000000:table/Users"
});
foreach (var tag in response.Tags)
Console.WriteLine($"{tag.Key} = {tag.Value}");Tags can be set during table creation:
await client.CreateTableAsync(new CreateTableRequest
{
TableName = "Users",
// ... key schema, attribute definitions ...
Tags =
[
new Tag { Key = "Project", Value = "MyApp" }
]
});DynamoDbLite uses the format arn:aws:dynamodb:local:000000000000:table/{tableName}. The table name is extracted from the last segment after /.
- Maximum 50 tags per resource
- Tag key maximum length: 128 characters
- Tag value maximum length: 256 characters
- Table must exist (throws
ResourceNotFoundExceptionotherwise)
Tags are automatically deleted when a table is deleted.
Returns a mock endpoint for local use.
var response = await client.DescribeEndpointsAsync(new DescribeEndpointsRequest());
// response.Endpoints[0].Address = "dynamodb.localhost"
// response.Endpoints[0].CachePeriodInMinutes = 1440Returns hardcoded capacity limits.
var response = await client.DescribeLimitsAsync(new DescribeLimitsRequest());
// response.AccountMaxReadCapacityUnits = 80,000
// response.AccountMaxWriteCapacityUnits = 80,000
// response.TableMaxReadCapacityUnits = 40,000
// response.TableMaxWriteCapacityUnits = 40,000Returns a static localhost endpoint.
var endpoint = client.DetermineServiceOperationEndpoint(request);
// endpoint.URL = "http://dynamodb.localhost"DynamoDbLite supports local file-based export and import in DYNAMODB_JSON format. Export runs entirely in the background and returns IN_PROGRESS immediately. Import creates the destination table synchronously, then loads items in the background — the table exists by the time the response arrives.
Exports all items from a table to local files.
var response = await client.ExportTableToPointInTimeAsync(
new ExportTableToPointInTimeRequest
{
TableArn = "arn:aws:dynamodb:local:000000000000:table/Users",
S3Bucket = "/tmp/exports",
S3Prefix = "my-export",
ExportFormat = ExportFormat.DYNAMODB_JSON
});
Console.WriteLine(response.ExportDescription.ExportArn);
Console.WriteLine(response.ExportDescription.ExportStatus); // IN_PROGRESSFile layout:
{s3Bucket}/{s3Prefix}/AWSDynamoDB/{exportId}/
manifest-summary.json
data/
00000000.json
00000001.json
...
If S3Prefix is omitted or empty, the layout becomes {s3Bucket}/AWSDynamoDB/{exportId}/.
Each data file contains one JSON object per line: {"Item":{...dynamodb json...}}
Files are split at 10,000 items each.
Check the status of an export.
var status = await client.DescribeExportAsync(new DescribeExportRequest
{
ExportArn = exportArn
});
Console.WriteLine(status.ExportDescription.ExportStatus); // COMPLETED or FAILED
Console.WriteLine(status.ExportDescription.ItemCount);List exports, optionally filtered by table ARN.
var response = await client.ListExportsAsync(new ListExportsRequest
{
TableArn = "arn:aws:dynamodb:local:000000000000:table/Users"
});Creates a table and imports items from local files.
var response = await client.ImportTableAsync(new ImportTableRequest
{
S3BucketSource = new S3BucketSource
{
S3Bucket = "/tmp/exports",
S3KeyPrefix = "my-export"
},
InputFormat = InputFormat.DYNAMODB_JSON,
TableCreationParameters = new TableCreationParameters
{
TableName = "UsersImported",
KeySchema =
[
new KeySchemaElement { AttributeName = "UserId", KeyType = KeyType.HASH }
],
AttributeDefinitions =
[
new AttributeDefinition { AttributeName = "UserId", AttributeType = ScalarAttributeType.S }
]
}
});The table is created synchronously before the background import begins.
Check import status and list imports:
var status = await client.DescribeImportAsync(new DescribeImportRequest
{
ImportArn = importArn
});
Console.WriteLine(status.ImportTableDescription.ImportStatus);
Console.WriteLine(status.ImportTableDescription.ImportedItemCount);- Files are written to and read from the local filesystem (not S3)
- Only
DYNAMODB_JSONformat is supported (ION is not implemented) - Compression is not supported
- Export runs as a background task; use
DescribeExportAsyncto poll for completion - Import creates the table synchronously, then imports items in the background
- Storage Architecture — SQLite schema, concurrency, expression engine
- API Parity — full compatibility matrix
Repo · NuGet · API Parity
Getting started
Reference
- Table Operations
- Item Operations
- Query and Scan
- Batch Operations
- Transactions
- Secondary Indexes
- TTL
- Tags and Admin
- DI and Configuration
- Concurrency
- Performance
- API Parity
- FAQ
Recipes
- DynamoDBContext for tests
- xUnit per-test isolation
- ASP.NET Core integration test fixture
- Migrating tests off DynamoDB Local
Internals