Skip to content

Instantly share code, notes, and snippets.

@ronan-cunningham
Last active June 18, 2021 21:57
Show Gist options
  • Save ronan-cunningham/3a4f76817e5e560bc2e02fd58905ecc1 to your computer and use it in GitHub Desktop.
Save ronan-cunningham/3a4f76817e5e560bc2e02fd58905ecc1 to your computer and use it in GitHub Desktop.
Create a DynamoDb time to live value using a number of days as an input
import time
def get_ttl(days: int) -> int:
seconds_since_epoch=int(str(time.time()).split('.')[0])
seconds_in_n_days=days * 86400
time_to_live=seconds_since_epoch + seconds_in_n_days
return time_to_live
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment