Skip to content

Instantly share code, notes, and snippets.

@singledigit
Last active November 6, 2020 18:50
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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 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