无法连接到端点 URL:"http://localhost:8000/" DynamoDB 与 Python

Could not connect to the endpoint URL: "http://localhost:8000/" DynamoDB with Python

我正在尝试按照文档中的教程进行操作:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.01.html

这样:

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

但是,我一直运行进入localhost:8000连接错误。 我正确安装了 boto3。 我不太确定我做错了什么。

谢谢。

来自 localhost 的 运行 用于测试的 DynamoDB 版本是从 Amazon 单独下载的,需要 Java 到 运行。我不相信它是任何其他包的一部分,包括 AWS-cli。您可以在 Setting Up DynamoDB Local (Downloadable Version).

找到相关说明