4

I tried this way but I get the error Invalid type for parameter ProvisionedThroughput.ReadCapacityUnits, value: on-demand, type: <class 'str'>, valid types: <class 'int'>

ProvisionedThroughput={ 'ReadCapacityUnits': 'on-demand', 'WriteCapacityUnits': 'on-demand' }

  • 2
    If you don't set `ProvisionedThroughput` I believe you get on-demand – JonSG Jun 11 '21 at 19:21
  • 1
    in the create_table() request use BillingMode='PAY_PER_REQUEST' docs here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.create_table – Jonathan Leon Jun 24 '21 at 03:23

1 Answers1

5
ddb.create_table(
    TableName='my_table',
    KeySchema=[
        {'AttributeName': 'id', 'KeyType': 'HASH'},
    ],
    AttributeDefinitions=[
        {'AttributeName': 'id', 'AttributeType': 'S'},
    ],
    BillingMode='PAY_PER_REQUEST',
)
serg
  • 1,003
  • 3
  • 16
  • 26