use*_*745 80 aws-cloudformation amazon-dynamodb
这是我的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"
}
Run Code Online (Sandbox Code Playgroud)
CloudFormation在尝试启动VPC时给出了这个错误: Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes.
但是......是吗?我指定audit_id为一个单独的键,它肯定存在于AttributeDefinitions列表中.我对CF(和Dynamo,对于那个问题)很新,所以我可能会错过一些非常明显的东西,但目前我并不明白.
我已经google了一下,只是真的发现了一个这个错误,这更多的是与开发人员和CF之间的层,而不是CF本身.
任何人都可以指出我的模板有什么问题吗?
use*_*745 176
这归结于我对DynamoDB的误解.这里应该定义的唯一属性是那些将用作键的属性.因此,将AttributeDefinitions数组更改为以下解决了以下问题:
"AttributeDefinitions": [
{
"AttributeName": "audit_id",
"AttributeType": "S"
}
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13352 次 |
| 最近记录: |