Hi @Anne-Leslie Dean
Cerbos doesn’t need that much memory, but “Lambda allocates CPU power in proportion to the amount of memory configured”, and also:
“Memory is the principal lever for controlling the performance of a function. The default setting, 128 MB, is the lowest possible setting. We recommend that you only use 128 MB for simple Lambda functions, such as those that transform and route events to other AWS services.”
It is also believed that allocated memory impacts the network bandwidth available to Lambda.
512MB corresponds to 0.3 vCPU, which I guess is rounded to 0.5 vCPU. That explains the lower start-up time for the 512MB Lambda, as Cerbos requires some compute power to download and compile policies.
To eliminate the impact of network latency, can you try embedding policies in the Cerbos lambda and using disk storage for Cerbos? Additionally, I assume the S3 bucket is located in the same region as the Cerbos Lambda. If not, the network latency might be higher.