使用云形成为DynamoDB启用TTL

时间:2018-01-17 22:17:41

标签: amazon-web-services amazon-dynamodb amazon-cloudformation

我正在尝试在现有的dynmoDB表上设置TTL

收到错误

  

发生错误:传入 - 属性值TimeToLiveSpecification必须是对象。

这是我的模板

    Incoming:
  Type: AWS::DynamoDB::Table
  Properties:
    TableName: table-test
    KeySchema:
      - AttributeName: number
        KeyType: HASH
      - AttributeName: number2
        KeyType: RANGE
    AttributeDefinitions:
      - AttributeName: number
        AttributeType: S
      - AttributeName: number2
        AttributeType: S
    TimeToLiveSpecification: 
      - AttributeName: TimeToLive
        Enabled: true
    ProvisionedThroughput:
      ReadCapacityUnits: 2
      WriteCapacityUnits: 2

我很可能会错过一些简单的东西,但无法弄清楚

1 个答案:

答案 0 :(得分:4)

弄明白了,在-部分AttributeName附近TimeToLiveSpecification附近放错了Incoming: Type: AWS::DynamoDB::Table Properties: TableName: table-test KeySchema: - AttributeName: number KeyType: HASH - AttributeName: number2 KeyType: RANGE AttributeDefinitions: - AttributeName: number AttributeType: S - AttributeName: number2 AttributeType: S TimeToLiveSpecification: AttributeName: TimeToLive # <-- stray dash was here Enabled: true ProvisionedThroughput: ReadCapacityUnits: 2 WriteCapacityUnits: 2

inline-block