Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How set up read/write capacity in dynamodb with ServiceStack.Aws

I want to set up a custom read/write capacity when SeriviceStack.Aws synchronizes my model.

I have this model

[Alias("TABLE-NAME")]
public class Company
{
    [AutoIncrement]
    public int CompanyId { get; set; }

    public int CountryId { get; set; }
    public string ShortName { get; set; }
    public string DocumentNumber { get; set; }
    public string FullName { get; set; }
    public string Address { get; set; }
    public DateTime CreatedAt { get; set; }
}

And is created with this code

var awsDb = new AmazonDynamoDBClient();
            var db = new PocoDynamo(awsDb)
                .RegisterTable<Company>();

            db.InitSchema();

How can set up a custom read/write capacity?

like image 596
Vladimir Venegas Avatar asked Jan 21 '26 10:01

Vladimir Venegas


1 Answers

The ProvisionedThroughput capacities can be set through a ProvisionedThroughputAttribute on a table POCO or defaults can be controlled on the PocoDynamo client by the ReadCapacityUnits and WriteCapacityUnits properties.

Tables are created by the InitSchema call which check if the registered table type has the ProvisionedThroughputAttribute first and falling back to the client specified capacities which by default are set to 10 Read, 5 Write.

like image 147
Darren Reid Avatar answered Jan 22 '26 23:01

Darren Reid