Last active
November 6, 2020 18:50
-
-
Save singledigit/ba3042d64443caa3de78f81bd7879193 to your computer and use it in GitHub Desktop.
Example of using VTL on Amazon API Gateway to insert an epoch time into Amazon DynamoDB to be used as a TTL field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This examples converts the millisecond epoch of API Gateway | |
## to the seconds epoch of DynamoDB and adds 5 minutes for the TTL. | |
#set( $epoch = $context.requestTimeEpoch / 1000 + 300 ) | |
{ | |
"TableName":"Epoch", | |
"Item":{ | |
"id":{"S":"$context.requestId"}, | |
"ttlTime":{"N":"$epoch"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment