[英]How to get epoch time in AWS Step Function
We can refer to the current time in AWS Step functions using "$$.State.EnteredTime", But that gives the ISO format.我们可以使用“$$.State.EnteredTime”在 AWS Step 函数中引用当前时间,但这给出了 ISO 格式。 Is there a way to get the Epoch seconds/milliseconds?
有没有办法获得纪元秒/毫秒? I want to add the TTL value in the DynamoDB based on that.
我想基于此在 DynamoDB 中添加 TTL 值。
Is this possible?这可能吗? Or do I have to invoke a Lambda function only for the timestamp?
或者我是否必须仅为时间戳调用 Lambda function?
This requires a Lambda Invoke Task .这需要一个Lambda Invoke Task 。 A small set of value transformations (eg string interpolation, JSON parsing) are natively handled by Intrinsic Functions .
一小部分值转换(例如字符串插值、JSON 解析)由Intrinsic Functions本地处理。 Most value transforms, however, including date manipulation, require an external task resource like Lambda.
但是,大多数值转换(包括日期操作)都需要外部任务资源,例如 Lambda。
"EpochExecutionTimeLambda": {
"Type": "Task",
"ResultPath": "$.epoch",
"Resource": "arn:aws:lambda:us-east-1:...",
"Parameters": {
"dateTime.$": "$$.State.EnteredTime"
}
The lambda handler is of course trivial: lambda 处理程序当然很简单:
exports.handler = async (event) => new Date(event.dateTime).valueOf()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.