I have the following Pyhton3/Boto3 script that connects to a AWS DynamoDB table and attempts to set a 19-day TTL on all its records by looping through them:
#!/usr/bin/env python3
import boto3
import sys
from datetime import datetime, timedelta
from boto3.dynamodb.conditions import Key, Attr
client = boto3.resource('dynamodb')
ttl = 19 # The TTL in number of DAYS
myTable = client.Table('MyTable')
pe = "logId, id, created"
delCount = 0
try:
response = integrationLogTable.scan(
ProjectionExpression=pe,
)
while 'LastEvaluatedKey' in response:
response = integrationLogTable.scan(
ProjectionExpression=pe,
ExclusiveStartKey=response['LastEvaluatedKey']
)
for i in response['Items']:
# ???
except ClientError as e:
print(e.response['Error']['Message'])
I'm struggling with how to actually add the 19-day TTL to all my records...any ideas?