使用云形成为 DynamoDB 启用 TTL

Enable TTL for DynamoDB using cloud formation

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

出现错误

An error occurred: Incoming - Value of property TimeToLiveSpecification must be an object.

这是我的模板

    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

我可能遗漏了一些简单的东西,但想不通

搞清楚了,在 TimeToLiveSpecification 部分

下的 AttributeName 附近放错了 -
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