amazon-dynamodb - 对流层 DynamoDB 生存时间规范
问题描述
我正在尝试为新的 DynamoDB 表创建 JSON Cloudformation 模板。我正在尝试设置 TimeToLiveSpecification,但出现错误并且对流层文档不清楚。
我有
dynamoDB = t.add_resource(Table(
"myDynamoTable",
TableName=Join("-", [Ref(env), "dynamo-table"]),
AttributeDefinitions=[
AttributeDefinition(
AttributeName=Ref(hashkeyname),
AttributeType=Ref(hashkeytype)
),
AttributeDefinition(
AttributeName="sqsMessageId",
AttributeType="S"
),
AttributeDefinition(
AttributeName="system",
AttributeType="S"
),`enter code here`
AttributeDefinition(
AttributeName=Ref(sortkeyname),
AttributeType=Ref(sortkeytype)
),
AttributeDefinition(
AttributeName="text",
AttributeType="S"
),
AttributeDefinition(
AttributeName="ttl",
AttributeType="N"
)
],
KeySchema=[
KeySchema(
AttributeName=Ref(hashkeyname),
KeyType="HASH"
),
KeySchema(
AttributeName=Ref(sortkeyname),
KeyType="RANGE"
)
],
TimeToLiveSpecification="WHAT GOES HERE???"
))
我什至尝试将其放入准备好的格式化 JSON 中,但它不起作用。我试过了:
TimeToLiveSpecification=AWSProperty(AttributeName="ttl", Enabled=True)
TimeToLiveSpecification=AttributeDefinition(AttributeName="ttl", Enabled=True)
TimeToLiveSpecification=TimeToLiveSchema(AttributeName="ttl", Enabled=True)
(用这个抓住稻草)。
解决方案
使用此处显示的 TimeToLiveSpecification 试试这个(未经测试):
TimeToLiveSpecification=TimeToLiveSpecification(
AttributeName="fill this in",
Enabled=True,
),
推荐阅读
- sql - 如何使用特定时间 SQL 检查重叠日期时间
- javascript - Jest - Jest 遇到了意外的令牌。香草JS
- php - 根据databsse中的值创建文件
- javascript - 如何从 fxml 中的 JavaScript 内部为 javaFX 调用 java 方法
- reactjs - Reactjs:如何传递来自不同文件的用户输入?
- git - 为什么我在 Android Studio 3.4.2 中从 Git 克隆项目时只创建本地 master 分支?
- python - 如何在没有重复结果的情况下从python中的字符串获取索引位置
- ruby - ruby 数组的最后一个元素是 nil
- tensorflow - tf.contrib.layers.feature_column 和 tf.feature_column 有什么关系?
- html - 突出显示部分文本