How to create a DynamoDB table using Python

0 votes
Can someone help me with the method of creating a DynamoDB table in Python?
Feb 22, 2019 in AWS by Survi
7,745 views

1 answer to this question.

0 votes

The code that you can use to create a tabke in Dynamo DB is as follows:-

import boto3

dynamodb = boto3.resource('dynamodb', region_name='us-east-1')

table = dynamodb.create_table(
    TableName='PhoneBook',
    KeySchema=[
        {
            'AttributeName': 'ID',
            'KeyType': 'HASH'  #Partition key
        },
        {
            'AttributeName': 'Name',
            'KeyType': 'RANGE'  #Sort key
        }
    ],
    AttributeDefinitions=[
        {
            'AttributeName': 'ID',
            'AttributeType': 'N'
        },
        {
            'AttributeName': 'Name',
            'AttributeType': 'S'
        },

    ],
    ProvisionedThroughput={
        'ReadCapacityUnits': 10,
        'WriteCapacityUnits': 10
    }
)

print("Table status:", table.table_status)
OUTPUT:
Table status: CREATING

answered Feb 22, 2019 by Priyaj
• 58,020 points

Related Questions In AWS

+4 votes
1 answer

How to create a lambda fucntion using Python?

Hey @Jino, I will tell you the ...READ MORE

answered Dec 20, 2018 in AWS by Nabarupa

edited Jun 9, 2020 by MD 989 views
0 votes
1 answer

How to create a DynamoDB using AWS CLI?

You can create a DynamoDB table using ...READ MORE

answered Feb 22, 2019 in AWS by Priyaj
• 58,020 points
1,898 views
0 votes
1 answer
0 votes
1 answer

How to load data into a table in DynamoDB using Java?

You can create a .json file with the ...READ MORE

answered Feb 26, 2019 in AWS by Priyaj
• 58,020 points
6,977 views
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

How to create a DynamoDB table using Java SDK?

The code to create a table in ...READ MORE

answered Feb 23, 2019 in AWS by Priyaj
• 58,020 points
2,602 views
0 votes
1 answer

How to create a DynamoDB table in AWS?

Creating a DynamoDB table is made very ...READ MORE

answered Feb 22, 2019 in AWS by Priyaj
• 58,020 points
1,272 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP