Shachaf.Gortler
Shachaf.Gortler

Reputation: 5735

Enable TTL for DynamoDB using cloud formation

I'm trying to setup a TTL on an existing dynmoDB table

Getting an error

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

this is my template

    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

I'm probalbly missing somethins simple , but can't figure it out

Upvotes: 4

Views: 3072

Answers (1)

Shachaf.Gortler
Shachaf.Gortler

Reputation: 5735

figured it out , a misplaced - near the AttributeName under the TimeToLiveSpecification section

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

Upvotes: 10

Related Questions