code

CloudFormation은 내 DynamoDB 생성 JSON이 유효하지 않다고 주장하지만 .. 방법을 볼 수 없습니다.

codestyles 2020. 10. 7. 07:41
반응형

CloudFormation은 내 DynamoDB 생성 JSON이 유효하지 않다고 주장하지만 .. 방법을 볼 수 없습니다.


다음은 Troposphere에서 생성 한 JSON (의 DynamoDB 부분)입니다.

"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를 스핀 업하려고 할 때 다음 오류를 표시 Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes합니다..

하지만 ... 그렇습니까? 나는 audit_id고독한 키로 지정 하고 있으며 확실히 AttributeDefinitions 목록 내에 존재합니다. 저는 CF (및 Dynamo)를 처음 접했기 때문에 매우 명백한 것을 놓치고있을 수 있지만 현재로서는 분명하지 않습니다.

나는 주위를 훑어 보았고이 오류에 대한 언급을 한 번만 찾았으며 CF 자체가 아닌 개발자와 CF 사이의 계층과 더 관련이 있습니다.

누구든지 내 템플릿의 문제점을 지적 할 수 있습니까?


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"
            }
]

참고URL : https://stackoverflow.com/questions/38142870/cloudformation-insists-my-dynamodb-creation-json-is-invalid-but-i-cant-see-h

반응형