how to create a table in dynamodb that is on-demand using python?
Asked Answered
W

1

5

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' }

Wollongong answered 11/6, 2021 at 17:46 Comment(2)
If you don't set ProvisionedThroughput I believe you get on-demandSeumas
in the create_table() request use BillingMode='PAY_PER_REQUEST' docs here: boto3.amazonaws.com/v1/documentation/api/latest/reference/…Guttle
S
6
ddb.create_table(
    TableName='my_table',
    KeySchema=[
        {'AttributeName': 'id', 'KeyType': 'HASH'},
    ],
    AttributeDefinitions=[
        {'AttributeName': 'id', 'AttributeType': 'S'},
    ],
    BillingMode='PAY_PER_REQUEST',
)
Spidery answered 5/11, 2021 at 20:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.