CloudFormation坚持我的DynamoDB创建JSON无效..但我看不到如何 [英] CloudFormation insists my DynamoDB creation JSON is invalid .. but I can't see how

查看:91
本文介绍了CloudFormation坚持我的DynamoDB创建JSON无效..但我看不到如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我对流层生成的JSON(DynamoDB的一部分):

Here's (the DynamoDB part of) my Troposphere-generated JSON:

"sandbox": {
        "Properties": {
            "AttributeDefinitions": [
                {
                    "AttributeName": "audit_id",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "status",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "filename",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "file_detected_dt",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "time_taken",
                    "AttributeType": "N"
                },
                {
                    "AttributeName": "number_rows_processed_file",
                    "AttributeType": "N"
                },
                {
                    "AttributeName": "number_rows_created_db",
                    "AttributeType": "N"
                },
                {
                    "AttributeName": "info_messages",
                    "AttributeType": "S"
                }
            ],
            "KeySchema": [
                {
                    "AttributeName": "audit_id",
                    "KeyType": "HASH"
                }
            ],
            "ProvisionedThroughput": {
                "ReadCapacityUnits": {
                    "Ref": "ReadCapacityUnits"
                },
                "WriteCapacityUnits": {
                    "Ref": "WriteCapacityUnits"
                }
            }
        },
        "Type": "AWS::DynamoDB::Table"
    }

CloudFormation在尝试启动VPC时给我这个错误:属性AttributeDefinitions与表的KeySchema和辅助索引不一致

CloudFormation gives me this error on trying to spin up the VPC: Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes.

但是...是吗?我指定 audit_id 作为一个单键,它肯定存在于AttributeDefinitions列表中。我对CF(以及Dynamo)非常陌生,所以我很可能会错过一些非常明显的东西,但目前对我来说还不明显。

But ... is it? I'm specifying audit_id as a lone key, and it definitely exists within the AttributeDefinitions list. I'm very new to CF (and Dynamo, for that matter) so I may well be missing something extremely obvious, but it's not apparent to me at the moment.

我四处搜寻,只真正发现了此错误,其中更多与开发人员和CF之间的层有关,而不是CF本身。

I've googled around and only really found one mention of this error, and it was more to do with a layer between developer and CF, rather than CF itself.

可以有人指出我的模板出了什么问题?

Can anyone point out what's wrong with my template?

推荐答案

这归因于我对DynamoDB的误解。此处应定义的 only 属性是将用作键的属性。因此,将AttributeDefinitions数组更改为以下内容可以解决问题:

This was down to a misunderstanding on my part regarding DynamoDB. The only attributes that should be defined here are those that will be used as keys. Thus, changing the AttributeDefinitions array to the following solved the problem:

"AttributeDefinitions": [
            {
                "AttributeName": "audit_id",
                "AttributeType": "S"
            }
]

这篇关于CloudFormation坚持我的DynamoDB创建JSON无效..但我看不到如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆