Search code examples
amazon-web-servicesamazon-s3aws-lambda

Restarting AWS lambda function to clear cache


I have a AWS Lambda function that creates an object from a s3 call in cold start. I then hold the object in the cache while the function is warm to keep load times down. When files are changed in s3, I have a trigger to run the lambda, but not all the running instances of lambda restart and pull from s3.

Is there a way to bring down all instances of lambda forcing a full cold start?

Also, I don't want to use python.


Solution

  • Use the UpdateFunctionCode API endpoint to force a refresh of all containers. AWS SDKs wrap this up to make it easier for you to call the API using your preferred language.