How can I uniquely ID the AWS Lambda container that my function is running in?

大城市里の小女人 提交于 2020-06-27 07:56:21

问题


I would like to get the (AWS Lambda container) instance ID that my function is running in.

For now I would just log it - it would help me when debugging issues with my caching algorithm: I could identify which invocations were happening in the same instance.

I looked at the docs for the context object and don't see anything there.

I could do it manually - and I'll put that below as my fallback answer - but I thought I would check whether some sort of real instance ID is available somehow.


回答1:


Could just generate a random GUID save that in global. (I'm just starting to look at this issue of container re-use and the potential for data caching, but I assume that node's 'global' object remains intact when an instance is re-used.)



来源:https://stackoverflow.com/questions/43213732/how-can-i-uniquely-id-the-aws-lambda-container-that-my-function-is-running-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!