una*_*men 1 ttl amazon-web-services amazon-dynamodb aws-cli
我想执行一个 cli 命令来创建一个带有 TTL 的表。
示例云形成/无服务器
SampleTBWithTTL:
Type: AWS::DynamoDB::Table
Properties:
TableName: SampleTBWithTTL
AttributeDefinitions:
- AttributeName: "user_id"
AttributeType: "N"
- AttributeName: "name"
AttributeType: "S"
KeySchema:
- AttributeName: "user_id"
KeyType: "HASH"
- AttributeName: "name"
KeyType: "RANGE"
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
TimeToLiveSpecification:
AttributeName: expiration
Enabled: true
Run Code Online (Sandbox Code Playgroud)
所以这就是我到目前为止所拥有的:
aws dynamodb create-table --table-name sample-tb-with-ttl \
--attribute-definitions AttributeName=user_id,AttributeType=N \
AttributeName=name,AttributeType=S \
--key-schema AttributeName=user_id,KeyType=HASH \
AttributeName=name,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \
Run Code Online (Sandbox Code Playgroud)
我想要/需要的是在我的 aws cli 命令中添加一个 TTL/TimeToLive 规范。
各位大侠帮帮我谢谢!!
首先这样做:-
aws dynamodb create-table --table-name sample-tb-with-ttl \
--attribute-definitions AttributeName=user_id,AttributeType=N \
AttributeName=name,AttributeType=S \
--key-schema AttributeName=user_id,KeyType=HASH \
AttributeName=name,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Run Code Online (Sandbox Code Playgroud)
然后启用 ttl :
aws dynamodb update-time-to-live --table-name sample-tb-with-ttl \
--time-to-live-specification Enabled=true,AttributeName=expiration
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
292 次 |
| 最近记录: |