Following this AWS blog, I can see that
A function transitions to the Inactive state when it has been idle long enough for the Lambda service to reclaim the external resources that were configured for it.
So what is long enough? I have Lambda functions deployed in a VPC that may be idle for weeks or months, and I'd like to avoid the Lambda.ResourceNotReadyException
and subsequent 502
status codes my client receives because the function is Inactive and a new network interface needs to be configured.
I just need the Lambdas to remain in Active state; don't need warm starts so not wanting to pay for Lambda's Provisioned Concurrency. I'm thinking to just trigger each Lambda in the VPC with a CloudWatch Event on some regular interval. I assume I could trigger once per day but really curious if I can find a more optimal solution here.
long enough is ~14 days.
I've gone through every mention of inactive & idle in the AWS Lambda docs.
The blog post you have linked mentions 'long enough':
The Lambda function states section of the docs also mentions 'long enough':
The Private Networking section of the docs mentions 'consecutive weeks':
However, the Lambda SnapStart and function states section of the docs is as closest as we get to a real answer: '14 days'.
My own testing also validates it to be approximately ~14 days.
I've submitted feedback to the AWS Lambda team to update the documentation to be more clear, or provide reasoning as to the lack of clarity on duration. It's unfortunate that it's not consistent.
I'll update my answer if/when I hear back.