1

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.

5
  • What is localhost:8000? Commented Aug 5, 2021 at 0:39
  • Did you install a DynamoDB server on your local computer, as that link says to do? Commented Aug 5, 2021 at 0:40
  • @JohnGordon Ah, I will give that a try. I thought I read that if I download AWS-cli it comes included. Commented Aug 5, 2021 at 0:42
  • No, it's a Java app that needs to run separately. Commented Aug 5, 2021 at 0:53
  • @MarkRansom Thank you got it working. Do you want to include it as answer? I can accept it. I think it may be helpful to other beginners such as myself. Commented Aug 5, 2021 at 1:26

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.