I have started to write Java Lambdas for some testing and they cold start painfully slowly for the first time (up to 30 seconds, after that it completes in 3 seconds). I read about the new AWS snapstart feature which was released in 2022 but I just can't enable it for my lambda and I dont see why it is not available for my function. Note that I am not using Spring or Spring boot. What I can confirm as prerequisites:
- Java version 11 (Corretto): I use this version
- Must have a published version: I published a new version after creating so this should be fine.
The symptom is that the snapstart configuration options are not available under configuration/General configuration, that section of the screen is empty, something like this:
I even tried to check the snapstart status and configuration via the aws CLI (aws lambda get-function-configuration --function-name XXXXXX) and it returns nothing about snapshot, like it doesn't even exist. It should show something like this (based on aws documentation) but this section is completely missing from the response: "SnapStart": { "ApplyOn": "PublishedVersions", "OptimizationStatus": "On" }, "State": "Active"
I thought it might be related to the jar size (40 MB) but I see the same with a small 1 MB image. Anyway, nothing stated on max function size. Am I missing something here? I even tried to create the lambda via the aws create-function but that rejects with accessdenied complaing about lambda:CreateFunction (which makes no sense, I have given admin rights to the functional account used with aws which has full aws lambda permissions).