I have a serverless yaml script that sets provisionedConcurrnecy to a value. Works great. However, I don’t want to run 24x7 with provisioned concurrency (too expensive). So … I wrote a lambda that sets the value to 1 during business hours, and then, since you can’t set it to 0, I delete the provisioned concurrency during non-business hours. I run this job every hour and it sets it on/off accordingly. Also works great. Here’s where the problem starts:
If I deploy the targeted service during off hours, it fails, because it can’t find the expected provisionedConcurrency configuration (because the hourly lambda deleted it!).
I am using provisionedConcurrency because it sets up all the alias’ and version, and configures my API correctly (to call the provisioned version) – all very handy and easy and extremely simple (just add the one line: provisionedConcurrency: 1). I tried using the alias plug-in but that had other side-effects that I hadn’t been able to work-around.
Any solutions to having provisioned concurrency on/off at different periods of time? It it were just a matter of scaling from 1 to 10 and back, I’d be fine. But I’m looking to shut it off completely.