amazon-web-services - 通过 updateTable 创建多个 GSI - DynamoDB

标签 amazon-web-services amazon-dynamodb amazon nosql

我正在使用 updateTable在 DynmaoDB 中,根据文档,如果我们要创建多个全局二级索引 (GSI),我们需要在“GlobalSecondaryIndexUpdates”字段中有多个对象,因此我传递了以下参数,但它不会更新 GSI;但是,如果我只是创建一个 GSI(在“GlobalSecondaryIndexUpdates”字段中传递一个对象,它可以工作);这是我为创建多个 GSI 而传递的参数:

{
    "TableName": "movies",
    "AttributeDefinitions": [{
            "AttributeName": "id",
            "AttributeType": "N"
        }, {
            "AttributeName": "title",
            "AttributeType": "S"
        }, {
            "AttributeName": "subtitle",
            "AttributeType": "S"
        }],
    "GlobalSecondaryIndexUpdates": [{
            "Create": {
                "IndexName": "title",
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": "5",
                    "WriteCapacityUnits": "5"
                },
                "KeySchema": [{
                        "AttributeName": "title",
                        "KeyType": "HASH"
                    }],
                "Projection": {
                    "ProjectionType": "ALL"
                }
            }
        }, {
            "Create": {
                "IndexName": "subtitle",
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": "5",
                    "WriteCapacityUnits": "5"
                },
                "KeySchema": [{
                        "AttributeName": "subtitle",
                        "KeyType": "HASH"
                    }],
                "Projection": {
                    "ProjectionType": "ALL"
                }
            }
        }]
}

我是否以错误的格式传递参数?

最佳答案

来自 DynamoDB documentation :

You can only create or delete one global secondary index per UpdateTable operation. However, if you run multiple UpdateTable operations simultaneously, you can create multiple indexes at a time. You can run up to five of these UpdateTable operations on a table at once, and each operation can create exactly one index.

关于amazon-web-services - 通过 updateTable 创建多个 GSI - DynamoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28402003/

相关文章:

amazon-web-services - Terraform IF 条件

amazon-web-services - 在 Elastic Beanstalk 中提交 .elasticbeanstalk/config.yml

amazon-web-services - 如何自动扩展 Amazon DynamoDB 吞吐量?

amazon-s3 - AWS 与 Lightsail,有何区别?

node.js - AWS Lambda 函数中的 XML 解析

amazon-web-services - 创建amazon s3存储桶时,是否可以设置自动写入存储桶的策略?

java - 在 Java 中将 DynamoDB JSON 文档转换为 JSON 对象

scala - 如何节流 Spark Streaming?

c# - ASP.NET 亚马逊商品搜索

linux - AWS 亚马逊 Linux : how to upload files from local to/var/www/html?