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

I would like to get the id of the instance (AWS Lambda container) in which my function is running.

Now I would just log it - it would help me when debugging problems with my caching algorithm: I could figure out which calls are happening in the same instance.

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

I could do it manually - and I'll put this below as my fallback answer, but I thought I'd check if some real instance id is available.

+3


source to share


1 answer


Can just generate a random GUID that is saved globally. (I'm just starting to look at this issue of container reuse and the potential for data caching, but my guess is that the 'global' node object remains intact when the instance is reused.)



+4


source







All Articles