Reputation: 614
I am trying to follow the tutorial within the documentation:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.01.html
as such:
def create_movie_table(dynamodb=None):
if not dynamodb:
dynamodb = boto3.resource('dynamodb',
aws_access_key_id="anything",
aws_secret_access_key="anything",
region_name = 'us-east-2',
endpoint_url="http://localhost:8000")
table = dynamodb.create_table(
TableName='DailyMovers',
KeySchema=[
{
'AttributeName': 'date',
'KeyType': 'HASH' # Partition key
},
{
'AttributeName': 'type',
'KeyType': 'RANGE' # Sort key
}
],
AttributeDefinitions=[
{
'AttributeName': 'date',
'AttributeType': 'S'
},
{
'AttributeName': 'type',
'AttributeType': 'S'
},
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
)
return table
if __name__ == '__main__':
create_movie_table()
However, I keep running into the localhost:8000 connection error. I am installed boto3 properly. I am not quite sure what I am doing wrong.
Thank you.
Upvotes: 1
Views: 1640
Reputation: 308520
The version of DynamoDB that runs from localhost
for testing is a separate download from Amazon which requires Java to run. I don't believe it's part of any other package including AWS-cli. You can find instructions for it at Setting Up DynamoDB Local (Downloadable Version).
Upvotes: 1