我似乎无法在dynamo db local中获得流支持,它们是否受支持?我能发现的唯一指示是http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html#Tools.DynamoDBLocal.Differences中的最后一个要点

使用dynamodb local时,似乎StreamSpecification被忽略,因此在调用createTable或describeTable时没有LatestStreamArn

下面的代码返回带有托管dynamodb服务而不是dynamodb local的LatestStreamArn:

ddb.createTable({
  TableName: 'streaming_test',

  AttributeDefinitions: [
    { AttributeName: 'id', AttributeType: 'S' }
  ],

  KeySchema: [
    { AttributeName: 'id', KeyType: 'HASH' }
  ],

  ProvisionedThroughput: {
    ReadCapacityUnits: 5,
    WriteCapacityUnits: 5
  },

  StreamSpecification: {
    StreamEnabled: true,
    StreamViewType: 'NEW_AND_OLD_IMAGES'
  }
}, function (err, data) {
  if (err) {
    console.log(err, err.stack)
  } else {
    // data.TableDescription.StreamSpecification and
    // data.TableDescription.LatestStreamArn are undefined
    // for dynamodb local
    console.log(data)
  }
})

最佳答案

我无法重现您的问题。我采取的步骤:


here下载DynamoDB Local
使用java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -sharedDb启动DynamoDB Local
导航到http://localhost:8000/shell/
粘贴下面的代码,然后单击播放按钮。我写的代码和上面的代码之间的唯一区别是,我用ddb替换了dynamodb


执行此操作时,我得到了一个非空且非空的arn:aws:dynamodb:ddblocal:000000000000:table/streaming_test/stream/2017-02-12T08:39:03.722 LatestStreamArn。

dynamodb.createTable({
  TableName: 'streaming_test',

  AttributeDefinitions: [
    { AttributeName: 'id', AttributeType: 'S' }
  ],

  KeySchema: [
    { AttributeName: 'id', KeyType: 'HASH' }
  ],

  ProvisionedThroughput: {
    ReadCapacityUnits: 5,
    WriteCapacityUnits: 5
  },

  StreamSpecification: {
    StreamEnabled: true,
    StreamViewType: 'NEW_AND_OLD_IMAGES'
  }
}, function (err, data) {
  if (err) {
    console.log(err, err.stack)
  } else {
    // data.TableDescription.StreamSpecification and
    // data.TableDescription.LatestStreamArn are undefined
    // for dynamodb local
    console.log(data)
  }
})

10-04 14:34