Here is an example of creating a DynamoDB table using Boto3:
import boto3
# Create a DynamoDB client
dynamodb = boto3.resource('dynamodb')
# Create a table
table = dynamodb.create_table(
TableName='Movies',
KeySchema=[
{
'AttributeName': 'year',
'KeyType': 'HASH' # Partition key
},
{
'AttributeName': 'title',
'KeyType': 'RANGE' # Sort key
}
],
AttributeDefinitions=[
{
'AttributeName': 'year',
'AttributeType': 'N'
},
{
'AttributeName': 'title',
'AttributeType': 'S'
}
],
ProvisionedThroughput={
'ReadCapacityUnits': 10,
'WriteCapacityUnits': 10
}
)
# Wait until the table exists.
table.meta.client.get_waiter('table_exists').wait(TableName='Movies')
print("Table status:", table.table_status)