DynamoDB in AWS
DynamoDB is a fully managed NoSQL database service that allows you to store and retrieve any amount of data. Here is an example of how to create a DynamoDB table using the AWS SDK for Python (boto3):
python
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.create_table(
TableName='my-table',
KeySchema=[
{
'AttributeName': 'id',
'KeyType': 'HASH'
}
],
AttributeDefinitions=[
{
'AttributeName': 'id',
'AttributeType': 'S'
}
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
)
This code creates a DynamoDB table named "my-table" with a single partition key called "id". It also specifies the provisioned throughput for the table, which determines the amount of read and write capacity that is available.
No comments:
Post a Comment