0

キースキーマをhash+rengeにしたい場合、どう書くのが正しいのでしょう?


起こったエラー

1 validation error detected: Value 'RENGE' at 'keySchema.
2.member.keyType' failed to satisfy constraint: Member must satisfy enum value set: [HASH, RANGE] (Service: AmazonDynamoDBv2;
Status Code: 400; Error Code: ValidationException; Request ID: L6GDTPVEFBAVKUOA4DR2LM9SHBVV4KQNSO5AEMVJF66Q9ASUAAJG)

以下、dynamodbリソース作成コードのみ抜粋

"DynamoDBTable":{
    "Type": "AWS::DynamoDB::Table",
    "Properties":{
        "TableName": {"Ref" : "DynamoDBTableName"},
        "BillingMode": "PAY_PER_REQUEST",
        "AttributeDefinitions":[
            {
                "AttributeName": "Id",
                "AttributeType": "S"
            },
            {
                "AttributeName": "Time",
                "AttributeType": "N"
            }
        ],
        "KeySchema":[
            {
                "AttributeName": "Id",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "Time",
                "KeyType": "RENGE"
            }
        ],
        "Tags":[
            {
                "Key": "Name",
                "Value": {"Ref" : "DynamoDBTableName"}
            }
        ]
    }
},
3
  • 1
    RANGE の綴りが誤っているかと。
    – sayuri
    2020年7月27日 0:05
  • うっかりでした。 2020年7月27日 0:13
  • 解決されたようならご自身で回答を投稿し、自己承認してください。
    – sayuri
    2020年7月27日 0:21

1 件の回答 1

0

綴りミスが原因で、RENGE ではなく RANGE でした。

"DynamoDBTable":{
    "Type": "AWS::DynamoDB::Table",
    "Properties":{
        "TableName": {"Ref" : "DynamoDBTableName"},
        "BillingMode": "PAY_PER_REQUEST",
        "AttributeDefinitions":[
            {
                "AttributeName": "Id",
                "AttributeType": "S"
            },
            {
                "AttributeName": "Time",
                "AttributeType": "N"
            }
        ],
        "KeySchema":[
            {
                "AttributeName": "Id",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "Time",
                "KeyType": "RANGE"
            }
        ],
        "Tags":[
            {
                "Key": "Name",
                "Value": {"Ref" : "DynamoDBTableName"}
            }
        ]
    }
},

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。